Использование ctx.guild.id не работает в процессоре Discord.py. Что я должен делать? ⇐ Python
-
Гость
Использование ctx.guild.id не работает в процессоре Discord.py. Что я должен делать?
I have a discord.py bot and I’ve just expanded to cogs, but now when I run a command that needs to access ctx.guild.id but I'm getting an error assuming that I’m trying to get cogname.guild.id. What should I change to fix this?
I tried:
Class cogname(commands.cog): @commands.hybrid_command(name=“testcommand”) async def testcommand(ctx): ctx.send(data[ctx.guild.id]) I expected the json data for the guild to be sent, but I get an error saying that the class mycog doesn’t have an attribute guild. What should I do?
I'm using the latest version of everything.
Источник: https://stackoverflow.com/questions/780 ... hould-i-do
I have a discord.py bot and I’ve just expanded to cogs, but now when I run a command that needs to access ctx.guild.id but I'm getting an error assuming that I’m trying to get cogname.guild.id. What should I change to fix this?
I tried:
Class cogname(commands.cog): @commands.hybrid_command(name=“testcommand”) async def testcommand(ctx): ctx.send(data[ctx.guild.id]) I expected the json data for the guild to be sent, but I get an error saying that the class mycog doesn’t have an attribute guild. What should I do?
I'm using the latest version of everything.
Источник: https://stackoverflow.com/questions/780 ... hould-i-do