【发布时间】:2021-07-06 03:48:46
【问题描述】:
我刚刚开始制作 Discord 机器人。我想创建一个命令,您可以在其中键入 -queue duos 以与其他想要的人一起排队游戏。但是,当我在 Discord 中键入命令时,我的添加角色命令完全没有响应,并且没有给出角色或错误。
import discord
import os
#run the Bot and a message to make sure it ran
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
#Detects if someone queues
if message.content.startswith('-queue duos'):
await message.channel.send('you have joined the duos queue.')
async def role(ctx, member : discord.Member, role : discord.Role):
await member.add_roles(role)
client.run(os.getenv('TOKEN'))
【问题讨论】:
-
欢迎来到 StackOverflow! “我的代码不起作用”并不是很有帮助。究竟是什么不工作?你都尝试了些什么?你也可以看看how to ask a good question
标签: discord discord.py bots