2025-03-11 16:16:39 +01:00
|
|
|
const { Client, GatewayIntentBits, MessageEmbed, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
|
|
|
const natural = require('natural');
|
|
|
|
const { BayesClassifier } = natural;
|
|
|
|
const classifier = new BayesClassifier
|
|
|
|
const tokenizer = new natural.WordTokenizer();
|
|
|
|
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
|
|
|
|
|
|
|
|
const channelId = ''; // Replace with your channel ID
|
|
|
|
|
|
|
|
// COINS CATEGORY
|
|
|
|
classifier.addDocument('how can I get more coins', 'coins');
|
|
|
|
classifier.addDocument('any advice on earning coins', 'coins');
|
|
|
|
classifier.addDocument('tips for getting coins quickly', 'coins');
|
|
|
|
classifier.addDocument('best ways to earn coins', 'coins');
|
|
|
|
classifier.addDocument('methods for obtaining coins', 'coins');
|
|
|
|
classifier.addDocument('how can I gather coins', 'coins');
|
|
|
|
classifier.addDocument('strategies to collect coins', 'coins');
|
|
|
|
classifier.addDocument('what are the techniques to get coins', 'coins');
|
|
|
|
// INVITE REWARD CATEGORY
|
|
|
|
classifier.addDocument('how to claim invite reward', 'invite');
|
|
|
|
classifier.addDocument('claim invite reward', 'invite');
|
|
|
|
classifier.addDocument('can I get an invite reward', 'invite');
|
|
|
|
classifier.addDocument('is there an invite reward', 'invite');
|
|
|
|
classifier.addDocument('steps to claim invite reward', 'invite');
|
|
|
|
classifier.addDocument('redeem invite reward', 'invite');
|
|
|
|
classifier.addDocument('process to get invite reward', 'invite');
|
|
|
|
classifier.addDocument('guide to claim invite reward', 'invite');
|
|
|
|
classifier.addDocument('how do I earn invite reward', 'invite');
|
|
|
|
classifier.addDocument('how can I receive invite reward', 'invite');
|
|
|
|
classifier.addDocument('getting reward for invites', 'invite');
|
|
|
|
classifier.addDocument('can I receive a reward for inviting friends', 'invite');
|
|
|
|
classifier.addDocument('how to get reward for inviting others', 'invite');
|
|
|
|
classifier.addDocument('steps to redeem invite reward', 'invite');
|
|
|
|
classifier.addDocument('how to obtain invite reward', 'invite');
|
|
|
|
// NEGATIVE COINS/INVITE CATEGORY
|
|
|
|
classifier.addDocument('how many coins do I need', 'not related');
|
|
|
|
classifier.addDocument('coins are used for', 'not related');
|
|
|
|
classifier.addDocument('what can I buy with coins', 'not related');
|
|
|
|
classifier.addDocument('you need to claim invite reward', 'not related');
|
|
|
|
classifier.addDocument('what is the invite reward', 'not related');
|
|
|
|
classifier.addDocument('can I invite more friends', 'not related');
|
|
|
|
classifier.addDocument('how many people can I invite', 'not related');
|
|
|
|
classifier.addDocument('is there a limit to invites', 'not related');
|
|
|
|
classifier.addDocument('how many invites are allowed', 'not related');
|
|
|
|
classifier.addDocument('how to increase invite count', 'not related');
|
|
|
|
classifier.addDocument('what are the rules for invites', 'not related');
|
|
|
|
classifier.addDocument('what is the maximum number of invites', 'not related');
|
|
|
|
classifier.addDocument('can I invite more than ten people', 'not related');
|
|
|
|
classifier.addDocument('how many friends can I invite', 'not related');
|
|
|
|
classifier.addDocument('is there an invite limit', 'not related');
|
|
|
|
classifier.addDocument('what is the invite threshold', 'not related');
|
|
|
|
classifier.addDocument('how does the invite system work', 'not related');
|
|
|
|
classifier.addDocument('rules for inviting people', 'not related');
|
|
|
|
classifier.addDocument('guidelines for inviting friends', 'not related');
|
|
|
|
classifier.addDocument('how to handle multiple invites', 'not related');
|
|
|
|
classifier.addDocument('coins', 'not related');
|
|
|
|
classifier.addDocument('invite', 'not related');
|
|
|
|
classifier.addDocument('what is coins', 'not related');
|
|
|
|
classifier.addDocument('tell me about coins', 'not related');
|
|
|
|
// NOT RELATED CATEGORY \\
|
|
|
|
classifier.addDocument('how is the weather today', 'not related');
|
|
|
|
classifier.addDocument('good afternoon', 'not related');
|
|
|
|
classifier.addDocument('see you later', 'not related');
|
|
|
|
classifier.addDocument('can you help me with something else', 'not related');
|
|
|
|
classifier.addDocument('what do you think about this', 'not related');
|
|
|
|
classifier.addDocument('where are you from', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite color', 'not related');
|
|
|
|
classifier.addDocument('tell me a joke', 'not related');
|
|
|
|
classifier.addDocument('what is your opinion', 'not related');
|
|
|
|
classifier.addDocument('do you like movies', 'not related');
|
|
|
|
classifier.addDocument('how old are you', 'not related');
|
|
|
|
classifier.addDocument('what are your hobbies', 'not related');
|
|
|
|
classifier.addDocument('where did you go', 'not related');
|
|
|
|
classifier.addDocument('can you suggest a book', 'not related');
|
|
|
|
classifier.addDocument('what music do you like', 'not related');
|
|
|
|
classifier.addDocument('goodbye', 'not related');
|
|
|
|
classifier.addDocument('what are your plans', 'not related');
|
|
|
|
classifier.addDocument('how was your day', 'not related');
|
|
|
|
classifier.addDocument('tell me a story', 'not related');
|
|
|
|
classifier.addDocument('what is your dream', 'not related');
|
|
|
|
classifier.addDocument('do you like sports', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite food', 'not related');
|
|
|
|
classifier.addDocument('where is the nearest restaurant', 'not related');
|
|
|
|
classifier.addDocument('do you have a pet', 'not related');
|
|
|
|
classifier.addDocument('what are you thinking about', 'not related');
|
|
|
|
classifier.addDocument('what do you do for fun', 'not related');
|
|
|
|
classifier.addDocument('tell me something interesting', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite book', 'not related');
|
|
|
|
classifier.addDocument('how do you spend your weekends', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite movie', 'not related');
|
|
|
|
classifier.addDocument('can you recommend a song', 'not related');
|
|
|
|
classifier.addDocument('what are your interests', 'not related');
|
|
|
|
classifier.addDocument('how is everything', 'not related');
|
|
|
|
classifier.addDocument('do you watch TV', 'not related');
|
|
|
|
classifier.addDocument('what do you like to eat', 'not related');
|
|
|
|
classifier.addDocument('how is your family', 'not related');
|
|
|
|
classifier.addDocument('what are your favorite hobbies', 'not related');
|
|
|
|
classifier.addDocument('what is the time', 'not related');
|
|
|
|
classifier.addDocument('how do you feel today', 'not related');
|
|
|
|
classifier.addDocument('do you play video games', 'not related');
|
|
|
|
classifier.addDocument('what is your job', 'not related');
|
|
|
|
classifier.addDocument('what do you do for a living', 'not related');
|
|
|
|
classifier.addDocument('how do you relax', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite sport', 'not related');
|
|
|
|
classifier.addDocument('do you have any siblings', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite season', 'not related');
|
|
|
|
classifier.addDocument('how was your weekend', 'not related');
|
|
|
|
classifier.addDocument('where do you live', 'not related');
|
|
|
|
classifier.addDocument('do you like to travel', 'not related');
|
|
|
|
classifier.addDocument('what languages do you speak', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite place', 'not related');
|
|
|
|
classifier.addDocument('can you tell me about yourself', 'not related');
|
|
|
|
classifier.addDocument('what are you doing now', 'not related');
|
|
|
|
classifier.addDocument('do you enjoy reading', 'not related');
|
|
|
|
classifier.addDocument('where do you work', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite TV show', 'not related');
|
|
|
|
classifier.addDocument('do you have any hobbies', 'not related');
|
|
|
|
classifier.addDocument('how do you spend your free time', 'not related');
|
|
|
|
classifier.addDocument('what do you think about this situation', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite game', 'not related');
|
|
|
|
classifier.addDocument('do you like cooking', 'not related');
|
|
|
|
classifier.addDocument('what are your thoughts on this', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite animal', 'not related');
|
|
|
|
classifier.addDocument('do you like to dance', 'not related');
|
|
|
|
classifier.addDocument('how do you celebrate holidays', 'not related');
|
|
|
|
classifier.addDocument('what is your favorite drink', 'not related');
|
|
|
|
|
|
|
|
classifier.train();
|
|
|
|
|
|
|
|
client.on('ready', () => {
|
|
|
|
console.log(`Logged in as ${client.user.tag}!`);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
client.on('messageCreate', message => {
|
|
|
|
if (message.channel.id === channelId && !message.author.bot) {
|
|
|
|
const userMessage = message.content.toLowerCase();
|
|
|
|
const tokens = tokenizer.tokenize(userMessage);
|
|
|
|
const normalizedMessage = tokens.join(' ');
|
|
|
|
const classifications = classifier.getClassifications(normalizedMessage);
|
|
|
|
const confidence = classifications[0].value;
|
|
|
|
|
|
|
|
console.log(userMessage);
|
|
|
|
console.log(tokens);
|
|
|
|
console.log(confidence);
|
|
|
|
console.log(classifications[0].label);
|
|
|
|
|
|
|
|
if (classifications[0].label === 'coins' && confidence > 0.008 && confidence < 0.9 && userMessage !== "coins") {
|
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setTitle('How to Get Coins')
|
|
|
|
.setDescription(`Here are some tips on how to get coins...\nConfidence: ${confidence}`)
|
|
|
|
.setColor('#00FF00');
|
|
|
|
|
|
|
|
const row = new ActionRowBuilder()
|
|
|
|
.addComponents(
|
|
|
|
new ButtonBuilder()
|
|
|
|
.setCustomId('delete')
|
|
|
|
.setLabel('🗑️ Delete')
|
|
|
|
.setStyle(ButtonStyle.Danger)
|
|
|
|
);
|
|
|
|
|
|
|
|
message.reply({ embeds: [embed], components: [row] });
|
2025-03-11 16:47:16 +01:00
|
|
|
} else if (classifications[0].label === 'invite' && confidence > 0.02 && confidence < 0.2 && userMessage !== "invite") {
|
2025-03-11 16:16:39 +01:00
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setTitle('How to Claim Invite Reward')
|
|
|
|
.setDescription(`Here are some tips on how to claim invite reward...\nConfidence: ${confidence}`)
|
|
|
|
.setColor('#00FF00');
|
|
|
|
|
|
|
|
const row = new ActionRowBuilder()
|
|
|
|
.addComponents(
|
|
|
|
new ButtonBuilder()
|
|
|
|
.setCustomId('delete')
|
|
|
|
.setLabel('🗑️ Delete')
|
|
|
|
.setStyle(ButtonStyle.Danger)
|
|
|
|
);
|
|
|
|
|
|
|
|
message.reply({ embeds: [embed], components: [row] });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
client.on('interactionCreate', async interaction => {
|
|
|
|
if (!interaction.isButton()) return;
|
|
|
|
if (interaction.customId === 'delete') {
|
|
|
|
await interaction.message.delete();
|
|
|
|
await interaction.reply({ content: 'Message deleted', ephemeral: true });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
client.login(''); // Replace with your bot token
|