Woor-discord.io sendMessage function randomly stopped working

Ive been running a discord bot from a server of mine for a few years now and its always worked just fine when sending messages and recieving them back. For exmaple if you type ‘!hello’ it will respond back to you using the sendMessage function. Recently it seems that either the messages are not getting through or just not working in general with no changes to the code. The weird thing is that when the uploadFile function runs it gets through just fine. Ill provide some code examples below.

    // 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);
        var cmd = args;
        
        switch(cmd) {
            
            //checking for user to reply yes
            case 'yes':

                bot.sendMessage({
                    to: channelID,
                    message: "Hello!"
                });
                break;
            case 'no':
 
                bot.uploadFile( {
                    to: channelID,
                    file: '/MY/FILE/PATH/pic.jpg'
                });
                break;

I saw in some posts that the “sendMessage” function was deprecated and to use the “send” function but even after updating the woor-discord.io library it says that “send” is not a function.

Leave a Comment