【发布时间】:2021-10-28 08:36:19
【问题描述】:
我整晚都在尝试编写一个单一的反应角色,但我无法让代码工作,机器人会对消息和所有内容做出反应,但当我做出反应时它没有给我角色
这是我的代码
@bot.command(name='rolecreate', help='creates all the default roles')
async def rolecreate(ctx):
Text= "React with :heart: to get the He/Him role!"
Moji1 = await ctx.send(Text)
reaction='❤️'
await Moji1.add_reaction(reaction)
async def on_reaction_add(reaction, member, ctx):
Channel = bot.get_channel('881380132789583892')
if reaction.message.channel.name!= Channel:
return
if reaction.emoji == "❤️":
guild= ctx.guild
he_him = discord.utils.get(guild.roles, name="He/Him")
if not he_him:
he_him = await guild.create_role(name="He/Him")
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。