midnightop / discord

0 stars 0 forks source link

I don't have a "client.on('message'..." code, mine looks like this: #2

Open midnightop opened 5 years ago

midnightop commented 5 years ago

JavaScript for making this discord bot

var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(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) == '!' || message.substring(0, 13) == '@Noddy the Bot') { //looks at the first character of the string counting from left
        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!'
                });
            break;
            // Just add any case commands if you want to..
         }
     }
});

The only client reference I have is the line that reads: var bot = new Discord.Client({

Originally posted by @DumbJoe in https://github.com/renesansz/discord-greeter-bot/issues/219#issuecomment-495994664

pablo-gbr commented 5 years ago

Oh, I see. Yours is bot.on('message'

midnightop commented 5 years ago

Oh, I see. Yours is bot.on('message'

Yes 😅

DumbJoe commented 5 years ago

uhh, you know you can just read my thread you linked.....

So basically what happened is that they had two versions, an outdated 2017(Or was it 2016 or earlier?) method and a 2019 method, the client.on is used in the 2019 method....

midnightop commented 5 years ago

uhh, you know you can just read my thread you linked.....

So basically what happened is that they had two versions, an outdated 2017(Or was it 2016 or earlier?) method and a 2019 method, the client.on is used in the 2019 method....

Oh 😆 but both are good thanks for commenting 😘

midnightop commented 5 years ago

uhh, you know you can just read my thread you linked.....

So basically what happened is that they had two versions, an outdated 2017(Or was it 2016 or earlier?) method and a 2019 method, the client.on is used in the 2019 method....

Yes but it's just for my library not for publicly announced

midnightop commented 5 years ago

uhh, you know you can just read my thread you linked.....

So basically what happened is that they had two versions, an outdated 2017(Or was it 2016 or earlier?) method and a 2019 method, the client.on is used in the 2019 method....

That's not your project ok that's official discord bot project so don't claim it

DumbJoe commented 5 years ago

Yes but it's just for my library not for publicly announced

Ah ok, well then I don't know why I was notified of this post then....probably because it linked back to my post...

That's not your project ok that's official discord bot project so don't claim it

Well technically it is my project since I started it up, but the code used was from the tutorial (and tutorials are free for all right?) and the other bits is from someone else helping me. And then you came along and copied my (almost complete) project....hahahahaha but I guess since it's public view anyways, so I suppose that's also free for all too.....

midnightop commented 5 years ago

Yes but it's just for my library not for publicly announced

Ah ok, well then I don't know why I was notified of this post then....probably because it linked back to my post...

That's not your project ok that's official discord bot project so don't claim it

Well technically it is my project since I started it up, but the code used was from the tutorial (and tutorials are free for all right?) and the other bits is from someone else helping me. And then you came along and copied my (almost complete) project....hahahahaha but I guess since it's public view anyways, so I suppose that's also free for all too.....

Ok ok no problem but, can I use it!?

DumbJoe commented 5 years ago

Ok ok no problem but, can I use it!?

Well it's in public space now so there's no point in trying to hide it.....or keep it a secret, so it's fair game here. ☺hah

-----------\▔\ ------------)....) -----------/..../▂▂▂ ▂▂╱┈ ▕▂▂▂▏ ▉┈-┈┈ ▕▂▂▂▏ ▉┈-┈┈▕▂▂▂▏ ▔▔╲▂▕▂▂▏

midnightop commented 5 years ago

Ok ok no problem but, can I use it!?

Well it's in public space now so there's no point in trying to hide it.....or keep it a secret, so it's fair game here. ☺hah

-----------\▔ ------------)....) -----------/..../▂▂▂ ▂▂╱┈ ▕▂▂▂▏ ▉┈-┈┈ ▕▂▂▂▏ ▉┈-┈┈▕▂▂▂▏ ▔▔╲▂▕▂▂▏

No no I mean can I use it for some personal work or something.....?? I don't care about it's public or private

DumbJoe commented 5 years ago

Well I did say it's fair game.....so yes...?

midnightop commented 5 years ago

Well I did say it's fair game.....so yes...?

🥰Uuuuuuuuuuhhhhhhhhhhhh