我想让我的机器人在用户输入特定句子时对消息做出反应。 我的回复代码: await ctx.message.reply("I just replied to you") 我得到了错误: ctx.message has no attribute "reply" 我可以做什么代码来让机器人回复消息? 当我说回复时,我的意思是用户可以在消息上按回复
我的机器人总是在有人提到他的时候发送消息,但只有当他们的消息内容只有提到时,我才想要bot回复。例如,当我发送@bot a时,他向我发送等待消息,而我希望删除此消息,并使bot只在某人发送@bot时才发送等待消息。
if message.content.startswith('<@868346872438345738>') or message.content.startswith('<@!868346872438345738>'):
await message.reply(f'Olá {message.au
我已经编写了一个不和谐机器人,它为对消息做出反应的用户添加了一个角色。机器人还会回复消息“Hallo bot”。但当我关闭机器人并重新打开它时,在我对另一条消息做出反应之前,该机器人不会回复该消息。 async def on_raw_reaction_add(self, payload):
mitglied = discord.utils.get(payload.member.guild.roles, name="Mitglied")
if str(payload.emoji) == "?":
a
我尝试只回复一条特定的消息一次。例如,如果有人写了什么,机器人就会说“有人没有打招呼”,如果他再次写了什么,机器人就不会再回复了。命令Im正在为else使用keep using @bot.event
async def on_message(message):
if message.content.startswith('hi'):
print('hello')
i=0
els
当我发送消息时,如何使机器人检查角色,然后回复该消息,我已经尝试了这么长时间,但无法弄清楚。这是tje第一次做机器人,所以试着变得更好。这是行不通的,只是垃圾邮件,即使是我没有作用
@client.event
async def on_message(ctx):
user = ctx.author
role = 1008827487024849097
if role in user.guild.roles:
if ctx.content == "hi":
await ctx.reply("hi")
if message.author.id != USER ID HERE:
msg = client.get_message(message, message.author)
await client.send_message(message.channel, msg)
我想让机器人复制人们的信息,然后说出来。(只是为了拉几个好朋友。无论如何,)有了这段代码,机器人在他们说什么的时候会回复,但用"“代替了完全相同的消息。
帮帮忙,好吗?
我一直在尝试创建一个bot命令,在命令发送后侦听消息。这意味着要用于创建命令作者的配置文件,以便稍后存储在json文件中。 async def create(ctx):
await ctx.send("You will be asked a series of questions to create your Profile. If you accidentally typed this wait 15 seconds for it to cancel.")
message = await client.wait_for('message',c
我是一个新的开发人员,试图通过使用python制作一个不和谐的机器人来学习。对于我的机器人的一部分,我希望它回复一条消息,等待10秒,然后删除回复和引用的消息。本能地,我使用time.sleep()来处理延迟,但是,这会使我的整个机器人暂停10秒,所以我尝试寻找替代方法,但没有成功。非常感谢任何有帮助的代码和对这些变化的解释! 当前代码: # Delete the referred to message
@client.event
async def on_reaction_add(reaction, user):
# <A bunch of other irrelevant
我在discord.py中遇到了问题,因为当我问一个问题并检查答案是否有效时,它会扫描缺少的消息,并立即发送我编码的错误消息,这应该只有在他们发送无效响应时才会发生。
if message.content.startswith('!examplecommand'):
await message.channel.send("Example Question?")
if message.content in Yes or if message.content in No:
await message.channel.send('E
我需要模拟一个论坛与Neo4j。我有有消息的“论坛”节点,而且这些消息也有回复:论坛->消息->回复。
我用来检索论坛信息及其回复的密码查询是:
start forum=node({forumId}) match forum-[*1..]->msg
where (msg.parent=0 and msg.ts<={ts} or msg.parent<>0)
return msg ORDER BY msg.ts DESC limit 10
此查询使用time<=ts检索消息及其所有答复(消息具有parent=0,答复具有parent<>0