【发布时间】:2021-02-26 22:02:58
【问题描述】:
因此,此代码旨在删除包含https 的任何消息。所以这针对不和谐的链接。但是,我想允许 4 个频道中的链接(频道 ID 如下)。但这目前只是删除所有 https 链接,无论服务器如何——我做错了什么?还是错过了?
if (message.content.includes("https")){
var channelID = ["766716351007686697", "770229235788677161", "766720626471206942", "766720685723746314"]
if (message.channel.id === channelID) return;
const https = new Discord.MessageEmbed()
https.setTitle(`Deleted Message`)
https.setDescription("Sorry But We Do Not Allow Links In That Channel");
https.setTimestamp();
message.author.send(https);
message.delete()
没有错误信息出现
【问题讨论】:
-
你能把它放在
try{} catch(err){}和console.log(err) 中吗?它说什么? -
@JonahG 如果我将来使用它,我会在代码中的哪个位置添加它?
标签: javascript discord discord.js