如何让我的不和谐机器人阅读其他机器人嵌入消息 [英] How to make my discord bot to read other bot embed messages
问题描述
我有最喜欢的不和谐机器人游戏,叫做EPIC RPG".有一个针对玩家的活动,所以我想制作一个机器人,可以通过提及特定角色并添加一些消息来宣布活动,我需要你的想法,
这是我的代码
client.on('message', (message) => {如果(message.author.id === '555955826880413696'){如果(message.embeds){常量嵌入 = message.embeds[0]if (embed.title === "**IT'S RAINING COINS**") {return message.channel.send('COIN RAIN 事件开始')}}}})
该代码是根据这张图片,因为我想用 IT'S RAINING COINS 语句触发命令并回复开始投币雨事件".
您应该更改 embed.title === "**IT'S RAINING COINS**"
to embed.title.includes("IT'S RAINING COINS")
最终结果:
client.on('message', (message) => {如果(message.author.id === '555955826880413696'){if (message.embeds.length == 1) {常量嵌入 = message.embeds[0]if (embed.title.includes(正在下雨的硬币")) {return message.channel.send('COIN RAIN 事件开始')}}}})
I have favorite discord bot game called "EPIC RPG" there's an event for players, so I wanted to make a bot that can announce the event with mention a specific role and adding some messages, i need your ideas pls,
Here's my code
client.on('message', (message) => {
if (message.author.id === '555955826880413696') {
if (message.embeds) {
const embed = message.embeds[0]
if (embed.title === "**IT'S RAINING COINS**") {
return message.channel.send('the COIN RAIN event is started')
}
}
}
})
that code is according to this picture, cuz I wanna trigger the command with the IT'S RAINING COINS statement and reply with "the coin rain event is started" https://i.stack.imgur.com/H5mjN.png, the problem is my bot cant read the embed messages, any ideas?
PS : when I started it, it shows that word title
on if (embed.title === "Theblablabla
is undefined
As I can see in the picture, the title of the embed isn't just a text but there is also an emoji:
You should change the embed.title === "**IT'S RAINING COINS**"
to embed.title.includes("IT'S RAINING COINS")
Final result:
client.on('message', (message) => {
if (message.author.id === '555955826880413696') {
if (message.embeds.length == 1) {
const embed = message.embeds[0]
if (embed.title.includes("IT'S RAINING COINS")) {
return message.channel.send('the COIN RAIN event is started')
}
}
}
})
这篇关于如何让我的不和谐机器人阅读其他机器人嵌入消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!