simplematrixbotlib updated to 2.10 from codeberg
This commit is contained in:
@@ -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.
|
||||
|
@@ -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.
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user