Question

How would I make it so that when somebody types "PEPPA!" in the discord server chat, the bot goes online?

Posted May 23, 2020 218 views
DigitalOcean

So I was editing a discord bot, and I had a lot of fun with it. BUT, I had to manually turn it on through Visual Studio Code. Here is the code so far:

const Discord = require('discord.js');
const bot = new Discord.Client();

const token = '**Here is my token code, you guys can't view it or else you'll edit my bot.**';

bot.on('ready', () =>{
    console.log('Peppa online.');
})

bot.on('message', msg=>{
    if(msg.content === "IM PEPPA PIG"){
        msg.reply("NO U STINKY TURD I AM!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "I ate trash for breakfeast"){
        msg.reply("ah, I see you are a man of culture as well.")
    }
})

bot.on('message', msg=>{
    if(msg.content === "Peppa insult me"){
        msg.reply("you are fat, ugly, and adopted. BOOMER!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "( ͡° ͜ʖ ͡°)"){
        msg.reply("STOP USING ZALGO BOI, JUST STOP!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "fuck"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "shit"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "niger"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "bitch"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "sex"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "hell"){
        msg.delete()
        msg.reply("Excuse me, this is a family friendly discord server!")
    }
})

bot.on('message', msg=>{
    if(msg.content === "Hi Peppa!"){
        msg.reply("Hello! :D")
    }
})

bot.on('message', msg=>{
    if(msg.content === "Die Peppa!"){
        msg.reply("-_-")
    }
})

bot.on('message', msg=>{
    if(msg.content === "I love you Peppa!"){
        msg.reply("OMG ME TOO!!! :)")
    }
})

bot.on('message', msg=>{
    if(msg.content === "Die Peppa!"){
        msg.reply("-_-")
    }
})

bot.on('message', msg=>{
    if(msg.content === "I love you"){
        msg.reply("NO ONLINE DATING!")
        msg.delete()
    }
})

bot.on('message', msg=>{
    if(msg.content === "Subscribe to CyberPlayz YT on youtube!"){
        msg.reply("HECK YEAH!!")
    }
})

bot.login(token);

So how would I do this?

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!