1.2.3 • Published 4 years ago

discord-spamchecker v1.2.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

discord-spamchecker

A package that allow your bot to determine user is/isn't spamming messages

install

type npm install discord-spamchecker to install this package

usage


definition

type this in the file:

const SpamChecker = require('discord-spamchecker');
const checker = new SpamChecker();


check message

inside your bot message event:

client.on("message", message => {
    const result = checker.check(message.author.id, message.guild.id, message);
    if(result === true) {
        console.log(message.author.tag + " is spamming message");
    }
})


getconfig

to get the config,use:

checker.getConfig(GUILD_ID);


update config

to update the config,use:

checker.updateConfig(CONFIG_KEY, VALUE, GUILD_ID);

CONFIG_KEY:

MSG_TIME_DIFF(milliseconds)

The collected data of the user you check will delete if : msg's_createdTimestamp_you_check - createdTimestamp_of_last_msg > MSG_TIME_DIFF* 2500 <= MSG_TIME_DIFF <= 10000

TIMER_TIMEOUT(milliseconds)

The collected data of the user will be auto delete if : current_time - the_time_of_create_user_data > TIMER_TIMEOUT* 5000 <= TIMER_TIMEOUT <= 20000

MSG_LIMIT

The user will be determined as spamming if : message_counter_of_user > MSG_LIMIT* 5 <= MSG_LIMIT <= 10


reset config

to reset the config,use:

checker.resetConfig(GUILD_ID);


delete data

delete the data of a guild

to delete the data of a guild,use:

checker.deleteGuildData(GUILD_ID);

delete the data of a user

to delete the data of a user,use:

checker.deleteUserData(GUILD_ID, USER_ID);

get data

get the data of a guild

to get the data of a guild,use:

checker.getGuildData(GUILD_ID);

get the data of a user

to get the data of a user,use:

checker.getUserData(GUILD_ID, USER_ID);

1.2.3

4 years ago

1.2.2-hotfix-3

4 years ago

1.2.2-hotfix-2

4 years ago

1.2.2-hotfix

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.6

4 years ago

1.1.6-hotfix

4 years ago

1.1.5

4 years ago

1.1.4-hotfix-2

4 years ago

1.1.4-hotfix

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago