Created
March 22, 2021 09:21
-
-
Save macedonga/2ac027ca427f0e7065e70ff7c35194bc to your computer and use it in GitHub Desktop.
Cheese
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require('discord.js') | |
const client = new Discord.Client(); | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
}); | |
const replace = [ | |
/ /g, | |
/\*/g, | |
/-/g, | |
/_/g, | |
/;/g, | |
/:/g, | |
/!/g, | |
/\"/g, | |
/'/g, | |
/&/g, | |
/%/g, | |
/:/g, | |
/,/g, | |
/</g, | |
/>/g, | |
/]/g, | |
/"#/g, | |
/@/g, | |
/§/g, | |
/{/g, | |
/}/g, | |
/ç/g, | |
/°/g | |
] | |
const WH = { | |
"cheese": { | |
username: 'cheese', | |
avatarURL: 'https://media.istockphoto.com/photos/cheese-on-white-picture-id1127471287?k=6&m=1127471287&s=612x612&w=0&h=UeS8tmYvojVM_ezFGg8NAKqi925-iJuzR4GNhxWSvFQ=' | |
} | |
}; | |
client.on('message', async msg => { | |
if (msg.author.bot || !msg.channel) return; | |
var content = msg.content; | |
content = content.toLowerCase(); | |
replace.forEach((rep) => content = content.replace(rep, "")); | |
const webhooks = await msg.channel.fetchWebhooks(); | |
var webhook = webhooks.first(); | |
if (!webhook) webhook = await msg.channel.createWebhook('cheese bot'); | |
if (content.includes("cheese")) webhook.send(":cheese:", WH.cheese); | |
}); | |
client.login(process.env.TOKEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment