19 lines
797 B
Python
19 lines
797 B
Python
import nerimity
|
|
|
|
import bot
|
|
import utils as u
|
|
|
|
def setup(bot: bot.Bot):
|
|
@bot.command(name="setfm", aliases=["set", "setuser", "setlastfm"])
|
|
@bot.slash_command(name="setfm", description="Sets your Last.fm username.")
|
|
async def setfm(ctx: nerimity.Context, username: str = None):
|
|
if not username:
|
|
await ctx.send(u.error_msg("Please provide your Last.fm username.\n\
|
|
usage: `/fm <your last.fm username>`"))
|
|
else:
|
|
try:
|
|
await bot.set_lastfm(ctx.author.id, username)
|
|
await ctx.send(u.good_msg(f"Your Last.fm user has been set to **{username}**!"))
|
|
except Exception as e:
|
|
print(e)
|
|
await ctx.send(u.error_msg("Unknown database error."))
|