我发出了反邀请命令,但是该漫游器没有删除在启用该命令的行会中发送的链接。 v12.2
if(message.content.includes(["https://discord.gg/", "https://discord.io/", "https://discord.me/"]))
答案 0 :(得分:0)
您需要检查message.content
是否分别包含每种可能性,因为该方法一次只能接受一个字符串。
答案 1 :(得分:0)
可以将.some()
与要检查indexOf的回调一起使用,这很短。
// mock
const message = {
content: 'Come join my room https://discord.gg/1234'
}
//
const links = ["https://discord.gg/", "https://discord.io/", "https://discord.me/"]
//
if (links.some(el => message.content.indexOf(el) !== -1)) {
// link/domain matched
}
还有其他方法也可以做到这一点,例如简单的正则表达式匹配。