async def set_mod(self,ctx,channel:discord.TextChannel):
print("ran")
print(channel)
guild = ctx.message.guild
print(guild)
channel_id = discord.utils.get(self.client.get_all_channels(), guild__name=guild, name=channel)
print(channel_id)
servers = await database.get_server_data()
server = ctx.guild.id
servers[str(server.id)]["mod_chat"] = channel_id
with open("servers.json", "w") as f:
json.dump(servers,f,indent=2)
return True
heres the error
ret = await coro(*args, **kwargs)
File "c:\Users\Titan1315\Desktop\Python projects\DashLeagueBot\cogs\setup.py", line 29, in set_mod
servers[str(server.id)]["mod_chat"] = channel_id
AttributeError: 'int' object has no attribute 'id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Titan1315\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Titan1315\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Titan1315\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'