mercredi 20 mai 2020

Discord.js v12 Bot Say Command in different channel (via args?)

Im looking for some help/direction/suggestion... I have my discord bot say command here, its taken me a while to get it this far and working. What im looking for is to adapt the current code so that i can check if the word after ".say" is a "#channel" and if so send the message there. ie ".say #feedback your welcome" ....... would result in the bot saying "your welcome" in the feedback channel ELSE just send the message within the same channel. I hope i have explained myself properly but this is over my head, iv tried to research as much as possible. thanks in advance for your time

        case 'say':
                if (!message.member.roles.cache.find(r => r.name === 'Moderator') && !message.member.roles.cache.find(r => r.name === 'Staff')) return message.channel.send('You dont not have the required permissions').then(msg => {
                    msg.delete({ timeout: 5000 })
                })
                else if (message.content.startsWith(".say")) {
                    if (message.deletable) {
                        message.delete();
                    }
                    if (!args[1]) return message.channel.send("Nothing to say").then(msg => {
                        msg.delete({ timeout: 5000 })

                    })
                    message.channel.send(`${(args.slice(1).join(" "))}`)

Aucun commentaire:

Enregistrer un commentaire