【发布时间】:2021-08-01 01:44:58
【问题描述】:
@client.command(pass_context=True)
async def autorole_test(ctx):
print("trying")
keystring5 = "Here you go!"
mee6 = discord.utils.get(ctx.guild.roles, name="Fresh Player")
channel = client.get_channel(870023245892575282)
messages = await ctx.channel.history().flatten()
for msg in messages:
if str(keystring5) in msg.content:
if mee6 in ctx.message.author.roles:
if ctx.message.author.mention in msg.content:
print("yes")
这是我上面的代码^
代码在发送“autorole_test”(我的命令前缀设置为“”)后正常工作,直到它到达“if ctx.message.author.mention in msg.content:”
即使有明确的消息符合在消息内容中提及消息作者的标准。有没有其他方法可以做到这一点,或者我在这里做错了什么?
任何帮助将不胜感激!
【问题讨论】:
标签: python python-3.x discord discord.py