久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何檢測是否提到了機器人?

How to detect if the bot has been mentioned?(如何檢測是否提到了機器人?)
本文介紹了如何檢測是否提到了機器人?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何檢測我的機器人是否被提及?

How can I detect if my bot is mentioned?

到目前為止,我嘗試了這些:

I tried these thus far:

if (msg.content.toLowerCase().includes('@The Guardian of The Bar#5180')) {
  msg.channel.send("My prefix here is" + prefix + "
 You can start with ``" + prefix + "help``");
}

if (msg.content.toLowerCase().includes('@The Guardian of The Bar')) {
  msg.channel.send("My prefix here is" + prefix + "
 You can start with ``" + prefix + "help``");
}

if (msg.content.includes('@The Guardian of The Bar#5180')) {
  msg.channel.send("My prefix here is" + prefix + "
 You can start with ``" + prefix + "help``");
}

if (msg.content.includes('@The Guardian of The Bar#5180')) {
  msg.channel.send("My prefix here is" + prefix + "
 You can start with ``" + prefix + "help``");
}

推薦答案

我對discord.js沒有經驗,但是根據this 在文檔中,消息對象有一個方法 message.isMemberMemberMember(User or GuildMember).使用這種方法,可以使用

I'm not experienced in discord.js, but according to this in the documentation, a message object has a method message.isMemberMentioned(User or GuildMember). Using this method, one can use

client.on('message', message => { //this event is fired, whenever the bot sees a new message
   if (message.isMemberMentioned(client.user)) { //we check, whether the bot is mentioned, client.user returns the user that the client is logged in as
      //this is where you put what you want to do now
   }
});

我想建議您在之前完整閱讀 文檔你試著做一個機器人.

I would like to recommend, that you read the documentation fully, before you try to make a bot.

在 v12 discord.js 上,您現在必須使用 message.mentions.has(bot.user)

On v12 discord.js you now have to use message.mentions.has(bot.user)

這篇關于如何檢測是否提到了機器人?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using discord.js to detect image and respond(使用 discord.js 檢測圖像并響應)
Check if user ID exists in Discord server(檢查 Discord 服務器中是否存在用戶 ID)
Guild Member Add does not work (discordjs)(公會成員添加不起作用(discordjs))
Creating my first bot using REPLIT but always error Discord.JS(使用 REPLIT 創建我的第一個機器人,但總是錯誤 Discord.JS)
How do I code event/command handlers for my Discord.js bot?(如何為我的 Discord.js 機器人編寫事件/命令處理程序?)
How to find a User ID from a Username in Discord.js?(如何從 Discord.js 中的用戶名中查找用戶 ID?)
主站蜘蛛池模板: 乳色吐息在线观看 | 成人一级黄色片 | 色综合五月 | 欧美黄色一级大片 | 在线不卡av| 午夜大片 | 四虎视频在线观看 | 日韩精品视频一区二区三区 | 亚洲人成免费 | 亚洲久草| 国产福利在线视频 | 一级片av | 久久精品一区二区国产 | 久久视频在线免费观看 | 国产美女精品视频 | 亚洲精品www | 国产三级在线观看 | 欧美日韩视频一区二区 | 色综合激情 | 深夜福利视频网站 | 玖玖在线观看 | 久久久久久综合 | 久久国产成人 | 免费一区二区视频 | 伊人影院综合 | 欧美一级免费 | 福利片在线 | 蜜桃久久久 | av网站在线免费观看 | 色黄视频在线观看 | 精品视频免费观看 | 亚洲精品99 | 男女啪啪网站 | 亚洲小视频| 99热国产在线 | 色综合av | 精品久久久久久久 | 天天操网 | 中文字幕免费av | 午夜视频网 | 国产成人精品一区二区三区在线 |