merge lastfm client into bot class
This commit is contained in:
parent
1ed84a6058
commit
1aebafc648
2 changed files with 10 additions and 9 deletions
7
bot.py
7
bot.py
|
|
@ -2,10 +2,15 @@ import os
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
import nerimity
|
import nerimity
|
||||||
|
import pylast
|
||||||
|
|
||||||
class Bot(nerimity.Client):
|
class Bot(nerimity.Client):
|
||||||
"""Extended client class for extra functionality."""
|
"""Extended client class for extra functionality."""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, lastfm_api_key: str, lastfm_api_secret: str, *args, **kwargs):
|
||||||
|
self.lastfm = pylast.LastFMNetwork(
|
||||||
|
api_key = lastfm_api_key,
|
||||||
|
api_secret = lastfm_api_secret
|
||||||
|
)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def load_commands(self, commands_dir: str):
|
def load_commands(self, commands_dir: str):
|
||||||
|
|
|
||||||
12
main.py
12
main.py
|
|
@ -8,16 +8,12 @@ import bot
|
||||||
with open("config.toml", "rb") as f:
|
with open("config.toml", "rb") as f:
|
||||||
config = tomllib.load(f)
|
config = tomllib.load(f)
|
||||||
|
|
||||||
# last.fm client
|
|
||||||
network = pylast.LastFMNetwork(
|
|
||||||
api_key = config['api_key'],
|
|
||||||
api_secret = config['api_secret']
|
|
||||||
)
|
|
||||||
|
|
||||||
# nerimity client
|
# nerimity client
|
||||||
bot = bot.Bot(
|
bot = bot.Bot(
|
||||||
token=config['token'],
|
token = config['token'],
|
||||||
prefix='!'
|
prefix = '!',
|
||||||
|
lastfm_api_key = config['api_key'],
|
||||||
|
lastfm_api_secret = config['api_secret']
|
||||||
)
|
)
|
||||||
|
|
||||||
bot.load_commands("commands")
|
bot.load_commands("commands")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue