Я создал бота для Discord. Я хочу что-то вроде того, что я вызываю команду «-f» в канале, я хочу, чтобы это вызывало другие команды или функции в других каналах и автоматически запускало потоки, например «-f a» в b, «-f +emote2» в c и т. д. ,
вот фрагмент кода
Код: Выделить всё
@bot.command()
async def f(ctx, *args):
result = False
if not args:
await ctx.channel.purge(limit=900)
await asyncio.sleep(0.21)
channel_A = discord.utils.get(ctx.guild.channels, name="pins")
if channel_A:
await channel_A.send("-f +🥰")
await ctx.invoke(bot.get_command('-f +🥰'))
else:
await ctx.send("Channel A not found.")
//there more code but it long and irelevant i think
оно также показывает ошибку
Код: Выделить всё
Traceback (most recent call last):
File "c:\Users\M Muzammil\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 235, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Personal\Auto upload\BOT.py", line 60, in f
await ctx.invoke(bot.get_command('-f +🥰'))
File "c:\Users\M Muzammil\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\context.py", line 336, in invoke
return await command(self, *args, **kwargs)
TypeError: 'NoneType' object is not callable
The above exception was the direct cause of the following exception:
Источник: https://stackoverflow.com/questions/781 ... iscord-bot