Python 在多个通道中创建不协调的bot类型
所以我创建了一个discord 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 "
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")