Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在多个通道中创建不协调的bot类型_Python_Discord - Fatal编程技术网

Python 在多个通道中创建不协调的bot类型

Python 在多个通道中创建不协调的bot类型,python,discord,Python,Discord,所以我创建了一个discord bot,但我只能输入一个服务器和一个通道。我如何使它可以输入多个通道 错误消息 Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "

所以我创建了一个discord bot,但我只能输入一个服务器和一个通道。我如何使它可以输入多个通道

错误消息

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 20, in on_message
    amount = int (message.content)
ValueError: invalid literal for int() with base 10: '!Start'
代码:


您使用的是discord.js还是discord.py?不管怎样,除非你有充分的理由,否则你最好使用

client = commands.Bot(command_prefix = "-")

@client.command()
async def Start(ctx):
    await ctx.send("Hi")
很抱歉,这无法回答您的问题,但它可能提供了一种使用不同方法获得结果的方法。另外,如果您使用discord.py rewrite,则在消息(message)上执行
async def:
而不使用
等待客户端。最后的process\u命令(message)
可能会破坏很多东西,因此请尝试将其添加到函数中

client = commands.Bot(command_prefix = "-")

@client.command()
async def Start(ctx):
    await ctx.send("Hi")