diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-03-06 16:04:08 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-03-06 16:04:08 +0100 |
commit | 2b08dc478e49fb8fd4d476e29abadcc29320cc32 (patch) | |
tree | c00f00fc5d545e2110ace4b2d472189e3c0b63cf /init.js | |
parent | 528df91cdb4618fff69ede49a381e49fe16afc93 (diff) | |
download | furrybot-discord-2b08dc478e49fb8fd4d476e29abadcc29320cc32.tar.xz |
Add copypasta
Diffstat (limited to 'init.js')
-rw-r--r-- | init.js | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,7 @@ const Discord = require("discord.js") const common = require("./common.js") +const copypasta = require("./copypasta.json") +const copypastaTrigger = require("./copypasta.js") const client = module.exports = new Discord.Client({ intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildMessages] @@ -15,7 +17,14 @@ let fb = { } client.on("messageCreate", msg => { - if (msg.author.id != client.user.id && msg.content.startsWith("!") && !fb.ignored[msg.author.id]) { + if (fb.ignored[msg.author.id] || msg.author.id == client.user.id) + return; + + const trigger = copypastaTrigger(msg.content.toLowerCase()) + if (trigger) + return msg.reply(copypasta[trigger]) + + if (msg.content.startsWith("!")) { let args = msg.content.replace(/@/g, "\\@").slice(1).split(" ") let cmd = args.shift() let def = fb.commands[cmd] |