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

@ -3,21 +3,15 @@
# Store current directory
current_dir=$(pwd)
# Clone the simplematrixbotlib repository
git clone https://github.com/imbev/simplematrixbotlib.git
# Load venv
source venv/bin/activate
# Copy the patch file to the simplematrixbotlib directory
cp 0001-Fixed-stability-issue-in-api.py.patch $current_dir/simplematrixbotlib/
# Clone the simplematrixbotlib repository
git clone https://codeberg.org/imbev/simplematrixbotlib.git
# Change directory to simplematrixbotlib
cd $current_dir/simplematrixbotlib/
# Apply the patch
git apply 0001-Fixed-stability-issue-in-api.py.patch
# Remove the patch file
rm 0001-Fixed-stability-issue-in-api.py.patch
# Install simplematrixbotlib
pip install .

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:

View File

@ -1,35 +1,4 @@
aiofiles==23.2.1
aiohttp==3.9.3
aiohttp-socks==0.7.1
aiosignal==1.3.1
async-timeout==4.0.3
attrs==23.2.0
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
cryptography==42.0.2
frozenlist==1.4.1
h11==0.14.0
h2==4.1.0
hpack==4.0.0
hyperframe==6.0.1
idna==3.6
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
Markdown==3.5.2
matrix-nio==0.23.0
multidict==6.0.5
pillow==10.2.0
pycparser==2.21
pycryptodome==3.20.0
python-cryptography-fernet-wrapper==1.0.4
python-dotenv==1.0.1
python-socks==2.4.4
pytube==15.0.0
referencing==0.33.0
requests==2.31.0
rpds-py==0.17.1
toml==0.10.2
unpaddedbase64==2.1.0
urllib3==2.2.0
yarl==1.9.4
python-dotenv
requests
pytube
duckduckgo_search