My code:
@bot.slash_command(guild_ids=[1002963156273999884])
async def admin(self, inter):
pass
@admin.sub_command()
async def status(self, inter, status: bot.status_options):
bot = self.bot
print(status)
async with aiofiles.open("config.json", "r") as f:
data = json.loads(await f.read())
activity = disnake.Game(name=data["activity"])
data["status"] = status
async with aiofiles.open("config.json", "w") as f:
await f.write(json.dumps(data, indent=4))
print(activity)
await bot.change_presence(status=status, activity=activity)
await inter.response.send_message(f"{bot.emoji_check} Status set to {status}")
print(f"Status set to {status} by {inter.author.name} ({inter.author.id})")
Print statements are me trying to debug. No error occurs and this is printed in the console correctly:
dnd
with code :)
Status set to dnd by EvilPanda (554343055029698571)