0
votes

I am getting follow message from discord and they keep resetting my bot token. Any assistance what could be wrong.

It appears your bot, TEST, has connected to Discord more than 1000 times within a short time period. Since this kind of behavior is usually a result of a bug we have gone ahead and reset your bot's token.

2
Maybe provide the code used so someone can debug the issue.Ghanima
here is the code [link] (pastebin.com/nr0wSpSm)blackninja
Could you explain what you are trying to accomplish ? It seems like you are instantiating many discord clients and trying to login all of them. You need to create only one Discord client, and login only once. Also, would you please paste your code directly in your question body, rather than on pastebin ?Gruntzy
@Gruntzy, Code is too big , it wont fit in question body.blackninja
Can you explain what your bot is supposed to do with your start method and your client.on("message", ... ) ? Your code is creating a new client everytime it handles a message, which is unnecessary.Gruntzy

2 Answers

1
votes

In your on message event

client.on('message', async msg => {
    msg.content = filter(msg.content)

    let channelid1 = 'xxxx' //
    let channelid2 = 'xx' //

    if (msg.channel.id == channelid1 && msg.author.id != client.user.id) {
        let attach = msg.attachments.array()
        let test = getUrls(msg.content);
        let arr = Array.from(test);
        let emojiname = ''

        if (msg.content.startsWith("<:uparrow:")) {
            emojiname = 'uparrow'
        } else if (msg.content.startsWith("<:downarrow:")) {
            emojiname = 'downarrow'
        }

        let name = msg.guild.emojis.find(emoji => emoji.name == emojiname);
        let embed = new Discord.RichEmbed()
            .setDescription(msg.content)
            .setColor('#A9A9A9')

        if (name) {
            start("Bot token xxxxx", 'Landing Discord channel ID xxx', embed, name)
        } else {
            start("Bot token xxxxx", 'Landing Discord channel ID xxx', embed)
        }

        if(arr.length > 0){
        for(let i in arr){
         start("Bot token xxxxx", 'Landing Discord channel ID xxx', arr[i])
         }
        }

        if (attach.length > 0) {
            start("Bot token xxxxx", 'Landing Discord channel ID xxx', attach[0].url)
        }
client.login('Client token xxxx') //
}

You need to remove calling the login function

client.login('Client token xxxx')

as you don't want your bot re-logging in every time the event is fired.

0
votes

From what I can see, every time the event is fired, it'll log into your bot again. Discord recognizes this and then resets your token. I would recommend removing

client.login('Client token xxxx') //

and putting it out of any events. You should also remove

client.login(token)