如何将我的Discord机器人变成多个服务器机器人
我做了一个不符合的机器人,它考虑了x和y之间的随机数,我使用了游戏标志(Ingame)来查看游戏是否已经启动,但是我现在有一个错误t开始游戏,因为服务器X启动。试图使用字典单独检查每个服务器,但实际上并不起作用。甚至在某人邀请机器人到服务器时添加行会名称,但它不起作用
games_in_progress = {}
@client.event
async def on_guild_join():
server = guild.name
print(server)
games_in_progress[guild.name] = False
print("Server added to the list")
global ingame
ingame = bool(True)
@client.command()
guild = ctx.guild
if guild not in games_in_progress:
games_in_progress[guild] = True
else:
if guild == "True":
await ctx.send("There is already a game in your server {}")
if ingame == True:
* do the code*
else:
await ctx.send("a game is already in progress, finish the game in {} to start a new
one!".format(gamechannel.mention))
I made a discord bot that thinks about a random number between X and Y and I used a game flag (ingame) to see if a game has already started or not but I have an error now that if server X started a game server Y can't start a game because server X started. Tried to use dictionaries to check each server individually but it doesn't really work. Even tried to add the guild name when someone invites the bot to the server but it didn't work aswell
games_in_progress = {}
@client.event
async def on_guild_join():
server = guild.name
print(server)
games_in_progress[guild.name] = False
print("Server added to the list")
global ingame
ingame = bool(True)
@client.command()
guild = ctx.guild
if guild not in games_in_progress:
games_in_progress[guild] = True
else:
if guild == "True":
await ctx.send("There is already a game in your server {}")
if ingame == True:
* do the code*
else:
await ctx.send("a game is already in progress, finish the game in {} to start a new
one!".format(gamechannel.mention))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论