add catbox uploader and collage generator to bot class
This commit is contained in:
parent
7be4fee669
commit
d649de8fb8
6 changed files with 36 additions and 6 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "catbox_async_uploader"]
|
||||||
|
path = catbox_async_uploader
|
||||||
|
url = https://github.com/IlkoChw/catbox_async_uploader
|
||||||
19
bot.py
19
bot.py
|
|
@ -1,13 +1,18 @@
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
import aiosqlite
|
|
||||||
|
|
||||||
import nerimity
|
import nerimity
|
||||||
import pylast
|
import pylast
|
||||||
|
import aiosqlite
|
||||||
|
|
||||||
|
from lastfmcollagegenerator.collage_generator import CollageGenerator
|
||||||
|
from catbox_async_uploader.catbox_async_uploader.core import CatboxAsyncUploader
|
||||||
|
|
||||||
class Bot(nerimity.Client):
|
class Bot(nerimity.Client):
|
||||||
"""Extended client class for extra functionality."""
|
"""Extended client class for extra functionality."""
|
||||||
def __init__(self, lastfm_api_key: str, lastfm_api_secret: str, owner_id: int = None, db_file: str = "database.db", *args, **kwargs):
|
def __init__(self, lastfm_api_key: str, lastfm_api_secret: str, catbox_hash: str,
|
||||||
|
owner_id: int = None, db_file: str = "database.db",
|
||||||
|
*args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.owner_id = owner_id
|
self.owner_id = owner_id
|
||||||
|
|
@ -18,6 +23,16 @@ class Bot(nerimity.Client):
|
||||||
api_secret = lastfm_api_secret
|
api_secret = lastfm_api_secret
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# initialize collage generator
|
||||||
|
self.collage_generator = CollageGenerator(
|
||||||
|
lastfm_api_key=lastfm_api_key,
|
||||||
|
lastfm_api_secret=lastfm_api_secret
|
||||||
|
)
|
||||||
|
|
||||||
|
# initialize catbox client
|
||||||
|
self.catbox_uploader = CatboxAsyncUploader(userhash=catbox_hash)
|
||||||
|
|
||||||
|
# database
|
||||||
self.db = None
|
self.db = None
|
||||||
self.db_file = db_file
|
self.db_file = db_file
|
||||||
|
|
||||||
|
|
|
||||||
1
catbox_async_uploader
Submodule
1
catbox_async_uploader
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 7c9e9a9efc833a7f4f7a9641bd81f7ea4881396a
|
||||||
|
|
@ -2,3 +2,5 @@ token = "NerimityTokenHere"
|
||||||
owner_id = 1234567890
|
owner_id = 1234567890
|
||||||
api_key = "LastFmApiKeyHere"
|
api_key = "LastFmApiKeyHere"
|
||||||
api_secret = "LastFmApiSecretHere"
|
api_secret = "LastFmApiSecretHere"
|
||||||
|
|
||||||
|
catbox_hash = "CatboxUserHashHere"
|
||||||
|
|
|
||||||
3
main.py
3
main.py
|
|
@ -11,7 +11,8 @@ bot = bot.Bot(
|
||||||
token = config['token'],
|
token = config['token'],
|
||||||
owner_id = config['owner_id'],
|
owner_id = config['owner_id'],
|
||||||
lastfm_api_key = config['api_key'],
|
lastfm_api_key = config['api_key'],
|
||||||
lastfm_api_secret = config['api_secret']
|
lastfm_api_secret = config['api_secret'],
|
||||||
|
catbox_hash = config['catbox_hash']
|
||||||
)
|
)
|
||||||
|
|
||||||
bot.load_commands("commands")
|
bot.load_commands("commands")
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,38 @@
|
||||||
|
aiofiles==24.1.0
|
||||||
aiohappyeyeballs==2.6.1
|
aiohappyeyeballs==2.6.1
|
||||||
aiohttp==3.13.0
|
aiohttp==3.10.10
|
||||||
aiosignal==1.4.0
|
aiosignal==1.4.0
|
||||||
aiosqlite==0.21.0
|
aiosqlite==0.21.0
|
||||||
anyio==4.11.0
|
anyio==4.11.0
|
||||||
astroid==3.3.11
|
astroid==3.3.11
|
||||||
attrs==25.4.0
|
attrs==25.4.0
|
||||||
|
beautifulsoup4==4.12.3
|
||||||
certifi==2025.10.5
|
certifi==2025.10.5
|
||||||
charset-normalizer==3.4.3
|
charset-normalizer==3.4.3
|
||||||
dill==0.4.0
|
dill==0.4.0
|
||||||
frozenlist==1.8.0
|
frozenlist==1.8.0
|
||||||
h11==0.16.0
|
h11==0.16.0
|
||||||
|
html5lib==1.1
|
||||||
httpcore==1.0.9
|
httpcore==1.0.9
|
||||||
httpx==0.28.1
|
httpx==0.28.1
|
||||||
idna==3.10
|
idna==3.10
|
||||||
isort==6.1.0
|
isort==6.1.0
|
||||||
|
lastfmcollagegenerator==0.4.13
|
||||||
mccabe==0.7.0
|
mccabe==0.7.0
|
||||||
multidict==6.7.0
|
multidict==6.7.0
|
||||||
nerimity==1.4.1
|
nerimity==1.4.1
|
||||||
|
pillow==10.4.0
|
||||||
platformdirs==4.4.0
|
platformdirs==4.4.0
|
||||||
propcache==0.4.0
|
propcache==0.4.0
|
||||||
pylast==6.0.0
|
pylast==5.3.0
|
||||||
pylint==3.3.9
|
pylint==3.3.9
|
||||||
requests==2.32.5
|
requests==2.32.3
|
||||||
|
six==1.17.0
|
||||||
sniffio==1.3.1
|
sniffio==1.3.1
|
||||||
|
soupsieve==2.8
|
||||||
tomlkit==0.13.3
|
tomlkit==0.13.3
|
||||||
typing_extensions==4.15.0
|
typing_extensions==4.15.0
|
||||||
urllib3==2.5.0
|
urllib3==2.5.0
|
||||||
|
webencodings==0.5.1
|
||||||
websockets==15.0.1
|
websockets==15.0.1
|
||||||
yarl==1.22.0
|
yarl==1.22.0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue