simplematrixbotlib updated to 2.10 from codeberg

This commit is contained in:
Hash Borgir
2024-02-13 10:08:26 -07:00
parent df87d39e82
commit 8c23deb13b
5 changed files with 19 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
# plugins/llm.py
# plugins/ai-music.py
import logging
import requests
@@ -7,7 +7,7 @@ import simplematrixbotlib as botlib
async def handle_command(room, message, bot, PREFIX):
"""
Function to handle the !gpt command.
Function to handle the !music command.
Args:
room (Room): The Matrix room where the command was invoked.

View File

@@ -1,4 +1,4 @@
# plugins/llm.py
# plugins/ai-tech.py
import logging
import requests
@@ -7,7 +7,7 @@ import simplematrixbotlib as botlib
async def handle_command(room, message, bot, PREFIX):
"""
Function to handle the !gpt command.
Function to handle the !funguy command.
Args:
room (Room): The Matrix room where the command was invoked.

View File

@@ -5,6 +5,11 @@ import logging
from pytube import YouTube
import simplematrixbotlib as botlib
def seconds_to_minutes_seconds(seconds):
minutes = seconds // 60
seconds %= 60
return f"{minutes:02d}:{seconds:02d}"
async def handle_command(room, message, bot, PREFIX):
"""
Function to handle YouTube video information from links.
@@ -28,10 +33,10 @@ async def handle_command(room, message, bot, PREFIX):
video = YouTube(youtube_url)
title = video.title
description = video.description
length = video.length
length = seconds_to_minutes_seconds(video.length)
views = video.views
author = video.author
info_message = f"""**🎬🎝 Title:** {title} | **Length**: {length} sec | **Views:** {views} | **Description:** {description}"""
info_message = f"""**🎬🎝 Title:** {title} | **Length**: {length} minutes| **Views:** {views} | **Description:** {description}"""
await bot.api.send_markdown_message(room.room_id, info_message)
logging.info("Sent YouTube video information to the room")
except Exception as e: