diff --git a/commands/Info/wolfcount.js b/commands/Info/wolfcount.js index c6980ba..a07c03a 100644 --- a/commands/Info/wolfcount.js +++ b/commands/Info/wolfcount.js @@ -34,7 +34,7 @@ mongoose.connect(uri, { module.exports = { name: "wolfcount", private: false, - description: "Returns the amount of times the letters wolf were said by users (state refreshes every 2 minutes).", + description: "Returns the amount of times the letters wolf were said by users.", run: async (client, interaction) => { diff --git a/commands/Management/DeleteApplicationCommands.js b/commands/Management/DeleteApplicationCommands.js new file mode 100644 index 0000000..ccba51f --- /dev/null +++ b/commands/Management/DeleteApplicationCommands.js @@ -0,0 +1,44 @@ +require("dotenv").config(); +const { EmbedBuilder, REST, Routes } = require('discord.js'); + +ownerList = [ + '213966480621043712' +]; + +const rest = new REST().setToken(process.env.TOKEN); + +// module.exports = { +// name: "deleteslashcommands", +// private: true, +// description: "Deregister guild slash commands", + +// run: async (client, interaction) => { +// if (ownerList.includes(interaction.user.id)) { + +// rest.put(Routes.applicationGuildCommands(client.user.id, interaction.guild.id), { body: [] }) +// .then(() => { +// console.log(`Successfully deleted all guild commands of guild ${interaction.guild.id}.`) +// const embed = new EmbedBuilder() +// .setColor("#FF0000") +// .setTitle("Slash commands deleted successfully") +// .setDescription(`Guild slash commands deleted successfully`) +// .setTimestamp() +// .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); +// interaction.followUp({ embeds: [embed] }); +// }) +// .catch((err) => { +// interaction.followUp({ content: 'Something went wrong'}); +// console.log(err); +// }); + +// } else { +// const embed = new EmbedBuilder() +// .setColor("#FF0000") +// .setTitle("🐺 no perms") +// .setDescription(`You have no perms to do this.`) +// .setTimestamp() +// .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); +// interaction.followUp({ embeds: [embed] }); +// } +// }, +// }; \ No newline at end of file diff --git a/commands/Management/SetStatus.js b/commands/Management/SetStatus.js new file mode 100644 index 0000000..f22ff1b --- /dev/null +++ b/commands/Management/SetStatus.js @@ -0,0 +1,36 @@ +const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); +const client = require('../../index.js'); + +developerList = [ + '213966480621043712', +]; + +module.exports = { + name: "setstatus", + private: true, + description: "Set status", + + run: async (client, interaction) => { + if (developerList.includes(interaction.user.id)) { + + client.user.setStatus('dnd') + + const embed = new EmbedBuilder() + .setColor("#FF0000") + .setTitle("Status set") + .setDescription(`Bot status set to predefined value`) + .setTimestamp() + .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); + interaction.followUp({ embeds: [embed] }); + + } else { + const embed = new EmbedBuilder() + .setColor("#FF0000") + .setTitle("🐺 no perms") + .setDescription(`You have no perms to do this.`) + .setTimestamp() + .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); + interaction.followUp({ embeds: [embed] }); + } + }, +}; diff --git a/commands/Info/resetwolfcount.js b/commands/Management/resetwolfcount.js similarity index 92% rename from commands/Info/resetwolfcount.js rename to commands/Management/resetwolfcount.js index 8e30238..bfc7748 100644 --- a/commands/Info/resetwolfcount.js +++ b/commands/Management/resetwolfcount.js @@ -1,5 +1,6 @@ const { EmbedBuilder } = require('discord.js'); const wolfcount = require('../../models/wolfcount'); +const { spawn } = require("child_process"); ownerList = [ '213966480621043712', @@ -33,6 +34,8 @@ module.exports = { .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); interaction.followUp({ embeds: [embed] }); + basecount = resetcount; + } else { const embed = new EmbedBuilder() .setColor("#FF0000") diff --git a/events/messageCreate.js b/events/messageCreate.js index 2a12a2e..cebdf7a 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -6,7 +6,7 @@ const wolfChars = ['w', 'o', 'l', 'f']; client.on("messageCreate", async (message) => { if (message.author.bot) return; - if (message.content.includes(">>")) return; + if (message.content.includes(">>") || message.content.includes(">r>")) return; // convert the message to lowercase const lowerMsg = message.content.toLowerCase(); @@ -27,6 +27,21 @@ client.on("messageCreate", async (message) => { console.log(''); console.log('Live wolf count:', newcount); + + if (newcount == 69) { + message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide + message.react("1103673748466434140").catch(err=>console.log(err)); // 69nice + } + + if (newcount == 100) { + message.react("💯").catch(err=>console.log(err)); + message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide + } + + if (newcount == 420) { + message.react("1103666748592488549").catch(err=>console.log(err)); // pogslide + message.react("1103675067054948392").catch(err=>console.log(err)); // pepe_high + } // update the wolf count wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: newcount}).then(() => { diff --git a/events/ready.js b/events/ready.js index 6ee3ff2..93ac9c7 100644 --- a/events/ready.js +++ b/events/ready.js @@ -1,15 +1,51 @@ const client = require("../index"); -const { ActivityType } = require('discord.js'); +const { EmbedBuilder, ActivityType } = require('discord.js'); client.on("ready", () => { - console.clear(); console.log(`${client.user.tag} is up and ready to go!`); // set the status to do not disturb // client.user.setStatus('dnd') - client.user.setPresence({ - activities: [{ name: `over msgs for certain letters`, type: ActivityType.Watching }], + // client.user.setPresence({ + // activities: [{ name: `over msgs for certain letters`, type: ActivityType.Watching }], + // status: 'dnd', + // }); + + client.user.setPresence({ + activities: [{ name: `RIP #1123`, type: ActivityType.Playing }], status: 'dnd', }); + + // Function to convert RGB to hex + function convertToHex(rgb) { + // Extract the RGB values using a regex pattern + const rgbValues = rgb.match(/\d+/g); + + // Convert each RGB value to a hexadecimal string + const hexValues = rgbValues.map((value) => { + // Convert the value to a number + const intValue = parseInt(value); + + // Convert the number to a hexadecimal string + const hexString = intValue.toString(16); + + // Pad the string with zero if needed + return hexString.padStart(2, '0'); + }); + + // Return the hex color string + return `#${hexValues.join('')}`; + }; + + const readyEmbed = new EmbedBuilder() + .setTitle('Now online!') + .setColor(convertToHex('rgb(119, 152, 229)')) + .setAuthor({ name: client.user.tag, iconURL: client.user.avatarURL() }) + .setTimestamp() + .setDescription(`${client.user.tag} is nu online`); + + // client.channels.cache.get(`967754078438449192`).send(`${client.user.tag} is nu online.`); + client.channels.cache.get(`967754078438449192`).send({ embeds: [readyEmbed] }) + }); diff --git a/handler/index.js b/handler/index.js index 4a55ca8..087d460 100644 --- a/handler/index.js +++ b/handler/index.js @@ -1,4 +1,5 @@ require("dotenv").config(); +const { ActivityType } = require("discord.js"); const { glob } = require("glob"); const { promisify } = require("util"); const globPromise = promisify(glob); @@ -54,7 +55,8 @@ module.exports = async (client) => { basecount = countdocument.count || 0; console.log(''); - console.log(`Starting count from ${basecount}`) + console.log(`Starting count from ${basecount}`); + console.log(``); }).catch((error) => { console.error(error); }); @@ -76,6 +78,11 @@ module.exports = async (client) => { // Slash Commands Register client.on("ready", async () => { + // client.user.setPresence({ + // activities: [{ name: `over msgs for certain letters`, type: ActivityType.Watching }], + // status: 'dnd', + // }); + cron.schedule('*/2 * * * *', async () => { console.log(`${moment(Date.now()).format('DD/MM/YY H:mm:ss')} Starting count refresh...`); diff --git a/index.js b/index.js index 5ea2c81..1ba86d4 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,27 @@ require("dotenv").config(); -const { Client, Collection } = require("discord.js"); +const { Client, Collection, Options } = require("discord.js"); -const client = new Client({ intents: 34305 }); +const client = new Client({ + intents: 34305, + makeCache: Options.cacheWithLimits({MessageManager: 0}) + // sweepers: { + // ...Options.DefaultSweeperSettings, + // messages: { + // interval: 120, // Every 2 minutes... + // lifetime: 600, // Remove messages older then 10 minutes. + // }, + // }, +}); module.exports = client; // Global Variables client.commands = new Collection(); client.slashCommands = new Collection(); +console.clear(); +console.log(''); +console.log(`Welcome to the console of wolfcount /--/ By Ultimateplayer1999 /--/ Discord: ultimateplayer#0369`); + // Initializing the project require("./handler")(client); diff --git a/package-lock.json b/package-lock.json index 49b695b..31e4883 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "ejs": "^3.1.9", "express": "^4.18.2", "glob": "^7.2.0", + "helmet": "^7.0.0", "moment": "^2.29.4", "mongoose": "^7.1.0", "node-cron": "^3.0.2" @@ -671,6 +672,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/helmet": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz", + "integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -1963,6 +1972,11 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, + "helmet": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz", + "integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==" + }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", diff --git a/package.json b/package.json index 98f664d..ed45b2f 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "ejs": "^3.1.9", "express": "^4.18.2", "glob": "^7.2.0", + "helmet": "^7.0.0", "moment": "^2.29.4", "mongoose": "^7.1.0", "node-cron": "^3.0.2" diff --git a/views/index.ejs b/views/index.ejs index 7af9b5b..e38fad3 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -8,126 +8,88 @@