Skip to content

My bot responds to any prefix??? #41

@Slurpity

Description

@Slurpity

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

const token = '(token taken out for obvious reasons)';

const PREFIX = '.';

var version = '0.420.69'

bot.on('ready', () =>{
console.log('Slurp Bot is now online!');
})

bot.on('message', message=>{

let args = message.content.substring(PREFIX.length).split(" ");

switch(args[0]){
    case 'website':
        message.channel.send('https://www.coolmathgames.com/')
        break;
    case 'info':
        message.channel.send('Version ' + version);
        break;
    case 'purge':
        if(!message.member.hasPermission("PRIORITY_SPEAKER", explicit = true)) return message.channel.send('You do not have permission to execute this command!')
        if(!args[1]) return message.channel.send('Please send an amount of messages to delete!')
        message.channel.bulkDelete(args[1]);
        break;
    

}

})

bot.login(token);


Okay, so my bot responds to any prefix... The prefix I use is "." so I should do .(command) for it to work right? no. I can do anything; f(command) y(command) ?(command). Any help? I am a complete noob to this.

(For the screenshot, Slurp-Bot's prefix is ";" and Slurp-Test-Bot's prefix is ".")
poop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions