nyx

The first CODM discrod bot -- cath.exe Template
git clone https://codeberg.org/night0721/nyx
Log | Files | Refs | LICENSE

commit 0df1fb14cac52d4a63c49961338aa68886c99730
parent 000b898809734dee0b721eca9762705fdb2e5d60
Author: night0721 <[email protected]>
Date:   Mon, 31 Jan 2022 01:17:26 +0800

fix bugs

Diffstat:
Mevents/messageCreate.js | 38+++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/events/messageCreate.js b/events/messageCreate.js @@ -77,11 +77,39 @@ client.on("messageCreate", async message => { .slice(0, -1) ) ) { - client.channels.cache - .get("936986641585799178") - .send({ - content: `User: ${message.author.tag}\nContent: ${message.content}`, - }); + const _ = new MessageEmbed().setTitle(`Scam detected`).addFields( + { + name: "Guild", + value: message.guild ? message.guild.name : "None", + inline: true, + }, + { + name: "User", + value: message.author.tag, + inline: true, + }, + { + name: "Message", + value: message.content, + inline: true, + }, + { + name: "Scam link", + value: message.content + + .toLowerCase() + .match( + /(https|http):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+~-]*[\w.,@?^=%&:/~+~-])+/g + )?.[0] + .replace(/(https|http):\/\/+/g, "") + .match(/\s*([^)]+?)\s*\/+/g, "")[0] + .slice(0, -1), + inline: true, + } + ); + client.channels.cache.get("936986641585799178").send({ + embeds: [_], + }); message.delete(); message.channel.send({ content: `**${message.author.tag}** has sent a scam link and I have deleted it to prevent spread`,