Last active
September 3, 2023 16:00
-
-
Save backgr02/fe678d83d512567f03ed9c3f1982fce8 to your computer and use it in GitHub Desktop.
痒い時はタウンワーク
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from misskey import Misskey | |
def post(body: dict): | |
print("post") | |
print(json.dumps(body)) | |
note = body['body']['note'] | |
user = body['body']['note']['user'] | |
if ("痒い" not in note.get('tags', [])): | |
return | |
# Input instance address (If leaved no attribute, it sets "misskey.io") | |
mk = Misskey( | |
address = "misskey.io", | |
i = "token", #FIXME: token | |
) | |
# Let's note! | |
mk.notes_create( | |
text = f"@{user['username']} そんな時は、タウンワーク!🐖", | |
reply_id = note['id'], | |
) | |
def lambda_handler(event, context): | |
print(json.dumps(event)) | |
print(context) | |
body = json.loads(event['body']) | |
post(body) | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Hello from Lambda!') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment