Facebook
From Arnnav Kudale, 4 Years ago, written in JavaScript.
This paste is a reply to JS 1 from Arnnav Kudale - go back
Embed
Viewing differences between JS 1 and JS 2
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) {
    // 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) {
            // !ping
            case 'ping':
                bot.sendMessage({
                    to: channelID,
                    message: 'Pong!'
                    
                });
                case 'youtube':
                bot.sendMessage({
                    to: channelID,
                    message: 'Its thebeastatFNBR or say "!yt link"if you want to go directly to the channel!'
                });
                 case 'yt link':
                bot.sendMessage({
                    to: channelID,
                    message: 'Here you go!https://www.youtube.com/channel/UCJBQemgOjflI4ie7XCGs-cA?view_as=subscriber '
                });
            break;
            // Just add any case commands if you want to..
         }
     }
});
{
"token": "Njk5MzM3NjI0NjI3ODM5MTE4.XpUBmA.ECl8lzlJHwvOwvPlM6DKmXuTWsE"
}


Replies to JS 2 rss

Title Name Language When
JS 3 Arnnav Kudale javascript 4 Years ago.