我有一个不和谐的机器人,需要在 while(True) 循环中运行,并且仍然接收命令。我认为我可以做到这一点并且适用于我的程序的唯一方法是运行 2 个单独的机器人实例。就像说:
client = commands.Bot(command_prefix = '!');
client2= commands.Bot(command_prefix = '.');
Run Code Online (Sandbox Code Playgroud)
然后在底部:
client.run('TOKEN')
client2.run('TOKEN')
Run Code Online (Sandbox Code Playgroud)
我尝试了这个,但没有成功。我究竟做错了什么?有没有一种方法可以从一个脚本运行 2 个机器人,或者运行同一个机器人两次?
我有一个看起来像这样的程序:
import things
import discord
def on_thing_happen (variable):
get_info()
do thing()
# This is where I want to send a message in Discord
Run Code Online (Sandbox Code Playgroud)
由于某些原因,我的其余代码无法在异步函数中工作。
有什么办法可以做到这一点吗?我无法使用异步定义。