32 lines
630 B
Python
32 lines
630 B
Python
import tomllib
|
|
|
|
import nerimity
|
|
import pylast
|
|
|
|
with open("config.toml", "rb") as f:
|
|
config = tomllib.load(f)
|
|
|
|
# last.fm client
|
|
network = pylast.LastFMNetwork(
|
|
api_key = config['api_key'],
|
|
api_secret = config['api_secret']
|
|
)
|
|
|
|
# nerimity client
|
|
client = nerimity.Client(
|
|
token=config['token'],
|
|
prefix='!'
|
|
)
|
|
|
|
# Prefix command -> !ping
|
|
@client.command(name="ping")
|
|
@client.slash_command(name="ping", description="Ping...")
|
|
async def ping(ctx: nerimity.Context):
|
|
await ctx.send("Pong!")
|
|
|
|
@client.listen("on_ready")
|
|
async def on_ready(params):
|
|
print(f"Logged in as {client.account.username}")
|
|
|
|
|
|
client.run()
|