Add entertainment category and fix incorrect variable name.
Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
parent
734362014c
commit
ad13e5d69f
10
main.py
10
main.py
@ -177,7 +177,10 @@ def is_music(youtube, video_id):
|
|||||||
video_details = youtube.videos().list(id=video_id, part="snippet").execute()
|
video_details = youtube.videos().list(id=video_id, part="snippet").execute()
|
||||||
|
|
||||||
# Check if the video category is Music (typically category ID 10)
|
# Check if the video category is Music (typically category ID 10)
|
||||||
return video_details["items"][0]["snippet"]["categoryId"] == "10"
|
return video_details["items"][0]["snippet"]["categoryId"] in (
|
||||||
|
"10",
|
||||||
|
"24",
|
||||||
|
) # music, entertainment
|
||||||
|
|
||||||
|
|
||||||
async def message_callback(client, room, event):
|
async def message_callback(client, room, event):
|
||||||
@ -211,7 +214,7 @@ async def message_callback(client, room, event):
|
|||||||
message_type="m.room.message",
|
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: # this is broken as shit
|
with open("./parker.gif", "rb") as gif_file: # this is broken as shit
|
||||||
response = await client.upload(gif_file, content_type="image/gif")
|
response = await client.upload(gif_file, content_type="image/gif")
|
||||||
if isinstance(response, UploadResponse):
|
if isinstance(response, UploadResponse):
|
||||||
print("Image was uploaded successfully to server. ")
|
print("Image was uploaded successfully to server. ")
|
||||||
@ -227,8 +230,7 @@ async def message_callback(client, room, event):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print(f"Failed to upload image. Failure response: {resp}")
|
print(f"Failed to upload image. Failure response: {response}")
|
||||||
|
|
||||||
|
|
||||||
if body == "!pow" and current_time - timestamp_sec < datetime.timedelta(
|
if body == "!pow" and current_time - timestamp_sec < datetime.timedelta(
|
||||||
seconds=30
|
seconds=30
|
||||||
|
Loading…
Reference in New Issue
Block a user