renesansz / discord-greeter-bot

My greeter bot for Discord
MIT License
49 stars 38 forks source link

message.author and similar variables are always undifineed please help ! #230

Closed WannaBeHum1n closed 5 years ago

WannaBeHum1n commented 5 years ago

var Discord = require('discord.io'); var logger = require('winston'); var auth = require('./auth.json'); // Configure logger settings logger.remove(logger.transports.Console); logger.add(new logger.transports.Console, { colorize: true }); logger.level = 'debug'; // Initialize Discord Bot var bot = new Discord.Client({ token: auth.token, autorun: true }); bot.on('ready', function (evt) { logger.info('Connected'); logger.info('Logged in as: '); logger.info(bot.username + ' - (' + bot.id + ')'); }); bot.on('message', function (user, userID, channelID, message, evt, author) { // Our bot needs to know if it will execute a command // It will listen for messages that will start with ! if (message.substring(0, 1) == '!') { var args = message.substring(1).split(' '); var cmd = args[0];

    args = args.splice(1);
    switch(cmd) {
        case `isZitounGay`:
            bot.sendMessage({
                to: channelID,
                message: `hell yeah`
            });
        break;
        case `sayMyName`:
            bot.sendMessage({  
                to: channelID,  
                message: `I am sure you are called ${message.author}`
        });   
        break;
     }
 }

});

WannaBeHum1n commented 5 years ago

help please

renesansz commented 5 years ago

On this line:

        case `sayMyName`:
            bot.sendMessage({  
                to: channelID,  
                message: `I am sure you are called ${message.author}`
        });   
        break;

replace your message to I am sure you are called ${author}

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.