SakiyaBackups / anti-phish-advanced

Advanced version of the Anti-Phishing Implementation.
GNU Affero General Public License v3.0
4 stars 2 forks source link

Bug or something #6

Closed Wreaking closed 2 years ago

Wreaking commented 2 years ago

hey so i was just testing my bot whether it detects phishing links or not. well it was working fine when i send the scam link second time it sends 2 message at the same time, i tried to search what was the error I couldn't find it so i tried to debug the error by using

console.log(data)

1)I've send the scan link in the channel and saw the terminal it looks fine 2) i send the scam link again and saw the terminal it sends the data twice at the same time

so its probably the package problem so can you quickly fix it please? thanks...

terminal Screenshot 2022-06-12 232733

Result Screenshot 2022-06-12 232847

tsukuyomiotoko commented 2 years ago

I've tested this locally and I have been unable to recreate the bug without changing anything. Feel free to send me your code, I'd be happy to look at it!

The code I was using:

const { Client, version } = require('discord.js');
const { Fish } = require('../lib/index'); //fancy imports
const client = new Client({ intents: ['GUILD_MESSAGES', 'GUILDS',] }); //create client, requires guild and guild messages to function.
const fish = new Fish(); //create fish

client.on("phishingMessage", (message, data) => {
    console.log(message, data); //"message" is the Message object containing the link, and "data" is the data returned by the api

    message.channel.send(`Phishing link detected by ${message.author}. Clicking this link may put your account at risk.`);
});

fish.init(client, version); //initialize fishing client, DO THIS BEFORE YOU LOGIN.
client.login('TOKEN'); //login to discord.

(It's the code in the test folder)

Screen_Shot_2022-06-12_at_7 37 36_PM Screen_Shot_2022-06-12_at_7 41 29_PM
Wreaking commented 2 years ago

im sorry i just realized that i have added

fish.init(client, version);

twice at the time in index.js so thats why its sends two msgs and datas at the same time.... i haven't noticed. I genuinely sorry for making a false bug report

tsukuyomiotoko commented 2 years ago

no worries man, glad you found the bug!