Make introduction visual.

Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
Abdulkadir Furkan Şanlı 2024-01-23 17:58:22 +01:00
parent 77a1275431
commit 438cb3e415
Signed by: afk
SSH Key Fingerprint: SHA256:s1hULLl4YWdqU501MUfGe1CAG/m1pf9Cs6vFsqeTNHk
2 changed files with 24 additions and 5 deletions

29
main.py
View File

@ -198,14 +198,33 @@ async def message_callback(client, room, event):
) # milisec to sec
current_time = datetime.now(datetime.UTC)
if body == "!parkerbot" and current_time - timestamp_sec < timedelta(seconds=30):
intro_message = ("Hi, I'm ParkerBot! I generate YouTube playlists "
"from links sent to this channel. You can find my source code here: "
"https://git.abdulocra.cy/abdulocracy/parkerbot")
if body == "!parkerbot" and current_time - timestamp_sec < timedelta(
seconds=30
):
intro_message = (
"Hi, I'm ParkerBot! I generate YouTube playlists from links "
"sent to this channel. You can find my source code here: "
"https://git.abdulocra.cy/abdulocracy/parkerbot"
)
await client.room_send(
room_id=room_id,
message_type="m.room.message",
content={"msgtype": "m.text", "body": intro_message}
content={"msgtype": "m.text", "body": intro_message},
)
with open("./parker.gif", "rb") as gif_file:
response = await client.upload(
gif_file.read(), content_type="image/gif"
)
gif_uri = response.content_uri
await client.room_send(
room_id=room_id,
message_type="m.room.message",
content={
"msgtype": "m.image",
"url": gif_uri,
"body": "parker.gif",
"info": {"mimetype": "image/gif"},
},
)
if body == "!pow" and current_time - timestamp_sec < timedelta(seconds=30):

BIN
parker.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB