def setstatus(ctx, *, status : str = None):
"""Sets status to passed in status; defaults to 'online'"""
if status is None:
bot.status = discord.Status.online
elif status == "online":
bot.status = discord.Status.online
elif status == "idle":
bot.status = discord.Status.idle
elif status == "offline" or status == "invisible":
bot.status = discord.Status.invisible
elif status == "do_not_disturb" or status == "dnd" or status == "do not disturb":
bot.status = discord.Status.dnd
else:
print("Unknown status named \"{}\"\nStatus change cancelled.".format(status))
await bot.say(embed=discord.Embed(title="Status", type="rich", timestamp=datetime.utcnow(), colour=0xFF0000, description="Unknown status \"{}\"\nStatus change cancelled.".format(status)))
return
print("Setting status to \"{}\"".format(bot.status))
await bot.say(embed=discord.Embed(title="Status", type="rich", timestamp=datetime.utcnow(), colour=get_status_color(), description="Current status set to {}".format(bot.status)))
await bot.change_presence(game=discord.Game(name=bot.game_name), status=bot.status)
评论列表
文章目录