bots - discord.js 机器人消息和响应有时有效,有时无效
问题描述
我试图让我的机器人用多个单词做出响应。我已将其设置为响应 30 多个单词。有时它会回应,有时它不会回应,有些词会回应,有些则不会。我不明白问题是什么?
下面是我的代码片段:
const test1 = '`test 123`';
const test2 = '`test 456`';
bot.on("message", function (message) {
if (message.content.includes(test1)) {
message.channel.send('hello');
}
if (message.content.includes(test2)) {
message.channel.send('goodbye');
}
解决方案
推荐阅读
- javascript - 在动态文本框上复制下拉值
- python - 尝试下载播放列表时,spotdl 包出现 HTTP 错误
- c++ - 在调试“无法打开 crtexe.c”期间从 main() 函数返回时出现这些类型的错误
- regex - 用于字符串解析的 Python 正则表达式
- python - 运行pytest时如何让pycharm输出颜色?
- php - 我如何知道并检查{用户是否从真正的 android 手机打开我的应用程序而不是浏览器检查(手机心情)}?
- swift - 是否有可以检测当前前台应用程序何时更改的 Swift macOS/Cocoa API?
- mysql - MySQL 逆序排列前 6 个月
- swift - 从 UIKit 到 SwitUI 的 SwiftUI 绑定/订阅,但在 SwiftUI 视图中不改变观察者
- asp.net-core - 是否可以在 cPanel 中托管 ASP.Net Core MVC 网站?