Changed template

This commit is contained in:
ultimateplayer1999 2023-04-28 11:48:43 +00:00
parent 37b0fc71ec
commit 0f4cecf9b0
16 changed files with 684 additions and 138 deletions

5
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
.env
node_modules
.env
package-lock.json

35
README.md Normal file
View File

@ -0,0 +1,35 @@
# Discord-Linux Discord.JS v14 Base Template
Only 3 dependencies required to run this bot!
Message intents are NOT supported in this bot, this is due to the verification that Discord is enabling.
Structure:
**commands** - This folder contains commands
**event** - This folder contains files related to discord.js events. (Like "ready", "interactionCreate")
**handler** - This folder contains files that read the commands folders contents.
**index.js** - This is the main file to run the bot.
1) Use ```npm i ```
2) Create a .env file ``` touch .env```
3) Edit .env
```
TOKEN = token
```
4) Go to Handler -- > index.js and change "GUIDIDHERE" to your Discord Server's Guild ID
5) Go into https://discord.com/developers/applications and enable Privileged Intents.
6) Run the bot ```node index.js```
Want to make this better? Issue a pull request!

View File

@ -1,98 +0,0 @@
require('dotenv').config();
const {Client, ActivityType} = require('discord.js');
const mongoose = require('mongoose');
const Wolfcount = require('./models/wolfcount');
console.clear();
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
mongoose.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log(`Connected to the database`);
}).catch((error) => {
console.log(`Failed to connect to the database`);
console.log(error);
});
const client = new Client({ intents: 34305 });
client.on("ready", () => {
// set the status to do not disturb
// client.user.setStatus('dnd')
client.user.setPresence({
activities: [{ name: `over msgs for certain letters`, type: ActivityType.Watching }],
status: 'dnd',
});
});
// Error handling
client.on("error", (error) => {
console.log('');
console.error("Something went wrong:", error);
});
// When a message is sent, check if the message includes the letters of wolf
const wolfChars = ['w', 'o', 'l', 'f'];
// Find a document by validation
Wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
console.log('');
console.log(countdocument);
}).catch((error) => {
console.error(error);
});
basecount = 0
// Reset the wolf count
Wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: basecount}).then(() => {
console.log('');
console.log('Count reset!');
}).catch((error) => {
console.error(error);
});
client.on("messageCreate", (message) => {
// convert the message to lowercase
const lowerMsg = message.content.toLowerCase();
// console.log(lowerMsg);
// check if the message has the letters
if (wolfChars.every(char=>lowerMsg.includes(char))) {
message.react("🐺").catch(err=>console.log(err));
newcount = basecount + 1;
client.user.setPresence({
activities: [{ name: `${newcount} message(s) detected`, type: ActivityType.Watching }],
status: 'dnd',
});
basecount = newcount;
console.log('');
console.log('Live wolf count:', newcount);
// update the wolf count
Wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: newcount}).then(() => {
console.log('Count updated!');
}).catch((error) => {
console.error(error);
});
// })
// Wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: newcount}, function(err, result){
// if(err){
// console.log('Something went wrong while updating the count:', err)
// }
// else{
// console.log('Successfully updated wolfcount to', result)
// }
// })
}
});
// Connect to Discord
client.login(process.env.BOT_TOKEN);

17
commands/Info/ping.js Normal file
View File

@ -0,0 +1,17 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "ping",
private: true,
description: "Returns websocket latency",
run: async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("🏓 Pong!")
.setDescription(`Latency : ${client.ws.ping}ms`)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
},
};

View File

@ -0,0 +1,46 @@
const { EmbedBuilder } = require('discord.js');
const wolfcount = require('../../models/wolfcount');
ownerList = [
'213966480621043712',
'237542879227019264',
'294840381080600576'
];
module.exports = {
name: "wolfcountreset",
private: true,
description: "Reset the wolfcount",
run: async (client, interaction) => {
if (ownerList.includes(interaction.user.id)) {
resetcount = 0
// Reset the wolf count
wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: resetcount}).then(() => {
console.log('');
console.log('Count reset!');
}).catch((error) => {
console.error(error);
});
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("🐺 count reset")
.setDescription(`The count has been reset. (Requested by: ${interaction.user.tag})`)
.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] });
}
},
};

View File

@ -0,0 +1,49 @@
require("dotenv").config();
const { EmbedBuilder } = require('discord.js');
const mongoose = require('mongoose');
const wolfcount = require('../../models/wolfcount');
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
mongoose.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('');
console.log(`Connected to the database`);
}).catch((error) => {
console.log(`Failed to connect to the database`);
console.log(error);
});
// setInterval(function() {
// // Find a document by validation
// wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
// console.log('');
// //console.log(countdocument);
// console.log(`Refreshed count`)
// count = countdocument.count
// console.log('');
// }).catch((error) => {
// console.error(error);
// });
// }, 30000);
module.exports = {
name: "wolfcount",
private: false,
description: "Returns the amount of times the letters wolf were said by users (state refreshes every 2 minutes).",
run: async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor("#03FC20")
.setTitle("🐺 count")
.setDescription(`I have counted ${basecount} wolf messages`)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
},
};

16
commands/context/ping.js Normal file
View File

@ -0,0 +1,16 @@
const { EmbedBuilder } = require('discord.js');
const {ApplicationCommandType } = require('discord.js');
module.exports = {
name: "ping-test",
type: ApplicationCommandType.Message,
run: async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("🏓 Pong!")
.setDescription(`Latency : ${client.ws.ping}ms`)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
},
};

View File

@ -0,0 +1,97 @@
const client = require("../index");
require("dotenv").config();
const { glob } = require("glob");
const { promisify } = require("util");
const globPromise = promisify(glob);
client.on("interactionCreate", async (interaction) => {
// Slash Commands
const slashCommands = await globPromise(`${process.cwd()}/commands/*/*.js`);
const arrayOfSlashCommands = [];
// Map the slash commands into data to be processed
slashCommands.map((value) => {
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (!file?.name) return;
const properties = {
directory,
...file
};
client.slashCommands.set(file.name, properties);
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
// Push the data
arrayOfSlashCommands.push(file);
});
// Slash Command Handling
if (interaction.isChatInputCommand()) {
// Grabbing Command Data for this interaction
let commandData = []
// We use ForEach here to filter our array into the single commands info.
await arrayOfSlashCommands.forEach(command => {
if (command.name == interaction.commandName) {
commandData.push(command)
}
});
// Process and Parse Data
let dataToProcess = JSON.stringify(commandData[0])
let parsedData = JSON.parse(dataToProcess)
if (interaction.commandName == "modal-example"){
console.log("Modal - Skipping defer")
} else {
// If the command is private, set ephemeral true else, set false
console.log(parsedData)
if (parsedData.private == true) {
await interaction.deferReply({
ephemeral: true
}).catch(() => {});
} else {
await interaction.deferReply({
ephemeral: false
}).catch(() => {});
}
}
const cmd = client.slashCommands.get(interaction.commandName);
if (!cmd)
return interaction.followUp({
content: "An error has occurred "
});
const args = [];
for (let option of interaction.options.data) {
if (option.type === "SUB_COMMAND") {
if (option.name) args.push(option.name);
option.options?.forEach((x) => {
if (x.value) args.push(x.value);
});
} else if (option.value) args.push(option.value);
}
interaction.member = interaction.guild.members.cache.get(interaction.user.id);
cmd.run(client, interaction, args);
}
// Context Menu Handling
if (interaction.isContextMenuCommand()) {
await interaction.deferReply({
ephemeral: false
});
const command = client.slashCommands.get(interaction.commandName);
if (command) command.run(client, interaction);
}
});

39
events/messageCreate.js Normal file
View File

@ -0,0 +1,39 @@
const client = require("../index");
const wolfcount = require('../models/wolfcount');
// When a message is sent, check if the message includes the letters of wolf
const wolfChars = ['w', 'o', 'l', 'f'];
client.on("messageCreate", async (message) => {
if (message.author.bot) return;
if (message.content.includes(">>")) return;
// convert the message to lowercase
const lowerMsg = message.content.toLowerCase();
// console.log(lowerMsg);
// check if the message has the letters
if (wolfChars.every(char=>lowerMsg.includes(char))) {
message.react("🐺").catch(err=>console.log(err));
newcount = basecount + 1;
// client.user.setPresence({
// // activities: [{ name: `${newcount} message(s) detected`, type: ActivityType.Watching }],
// activities: [{ name: `${newcount} message(s) detected` }],
// status: 'dnd',
// });
basecount = newcount;
console.log('');
console.log('Live wolf count:', newcount);
// update the wolf count
wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: newcount}).then(() => {
console.log('Count updated!');
}).catch((error) => {
console.error(error);
});
}
});

15
events/ready.js Normal file
View File

@ -0,0 +1,15 @@
const client = require("../index");
const { 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 }],
status: 'dnd',
});
});

View File

@ -1,4 +1,4 @@
BOT_TOKEN=<bottoken>
TOKEN=<bottoken>
#Mongodb cloud
DB_URL=<optional>
MONGODBUSER=<Username>

108
handler/index.js Normal file
View File

@ -0,0 +1,108 @@
require("dotenv").config();
const { glob } = require("glob");
const { promisify } = require("util");
const globPromise = promisify(glob);
const mongoose = require('mongoose');
const wolfcount = require('../models/wolfcount');
var cron = require('node-cron');
const moment = require('moment');
module.exports = async (client) => {
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
mongoose.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('');
console.log(`Connected to the database`);
}).catch((error) => {
console.log(`Failed to connect to the database`);
console.log(error);
});
// Slash Commands
const slashCommands = await globPromise(`${process.cwd()}/commands/*/*.js`);
const arrayOfSlashCommands = [];
slashCommands.map((value) => {
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (!file?.name) return;
const properties = { directory, ...file };
client.slashCommands.set(file.name, properties);
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
arrayOfSlashCommands.push(file);
});
// Events
const eventFiles = await globPromise(`${process.cwd()}/events/*.js`);
eventFiles.map((value) => require(value));
// Find a document by validation
wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
console.log('');
console.log(countdocument);
basecount = countdocument.count || 0;
console.log('');
console.log(`Starting count from ${basecount}`)
}).catch((error) => {
console.error(error);
});
// setInterval(function() {
// // Find a document by validation
// wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
// console.log('');
// //console.log(countdocument);
// console.log(`Refreshed count`)
// basecount = countdocument.count
// console.log('');
// }).catch((error) => {
// console.error(error);
// });
// }, 30000);
cron.schedule('*/2 * * * *', async () => {
console.log(`${moment(Date.now()).format('DD/MM/YY H:mm:ss')} Starting count refresh...`);
// Find a document by validation
wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
console.log('');
//console.log(countdocument);
console.log(`Refreshed count`)
basecount = countdocument.count
console.log('');
}).catch((error) => {
console.error(error);
});
console.log(`${moment(Date.now()).format('DD/MM/YY H:mm:ss')} Refreshed wolfcount on cron`);
});
// Slash Commands Register
client.on("ready", async () => {
// Register for a single guild
await client.guilds.cache.get("239352426451304449").commands.set(arrayOfSlashCommands);
// Register for a single guild
await client.guilds.cache.get("1075800713323610142").commands.set(arrayOfSlashCommands);
// Register for all the guilds the bot is in
// await client.application.commands.set(arrayOfSlashCommands);
});
// Error handling
client.on("error", async (error) => {
console.log('');
console.error("Something went wrong:", error);
});
};

14
index.js Normal file
View File

@ -0,0 +1,14 @@
require("dotenv").config();
const { Client, Collection } = require("discord.js");
const client = new Client({ intents: 34305 });
module.exports = client;
// Global Variables
client.commands = new Collection();
client.slashCommands = new Collection();
// Initializing the project
require("./handler")(client);
client.login(process.env.TOKEN);

264
package-lock.json generated
View File

@ -9,9 +9,12 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"discord.js": "^14.9.0",
"dotenv": "^16.0.3",
"mongoose": "^7.0.5"
"discord.js": "^14.0.3",
"dotenv": "^16.0.0",
"glob": "^7.2.0",
"moment": "^2.29.4",
"mongoose": "^7.1.0",
"node-cron": "^3.0.2"
}
},
"node_modules/@discordjs/builders": {
@ -113,9 +116,9 @@
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="
},
"node_modules/@types/node": {
"version": "18.16.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz",
"integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ=="
"version": "18.16.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz",
"integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg=="
},
"node_modules/@types/webidl-conversions": {
"version": "7.0.0",
@ -139,6 +142,20 @@
"@types/node": "*"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/bson": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-5.2.0.tgz",
@ -158,6 +175,11 @@
"node": ">=10.16.0"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -236,6 +258,30 @@
"url": "https://github.com/sindresorhus/file-type?sponsor=1"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -255,6 +301,15 @@
}
]
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@ -289,12 +344,31 @@
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
"optional": true
},
"node_modules/mongodb": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.1.0.tgz",
"integrity": "sha512-qgKb7y+EI90y4weY3z5+lIgm8wmexbonz0GalHkSElQXVKtRuwqXuhXKccyvIjXCJVy9qPV82zsinY0W1FBnJw==",
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"bson": "^5.0.1",
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"engines": {
"node": "*"
}
},
"node_modules/mongodb": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.3.0.tgz",
"integrity": "sha512-Wy/sbahguL8c3TXQWXmuBabiLD+iVmz+tOgQf+FwkCjhUIorqbAxRbbz00g4ZoN4sXIPwpAlTANMaGRjGGTikQ==",
"dependencies": {
"bson": "^5.2.0",
"mongodb-connection-string-url": "^2.6.0",
"socks": "^2.7.1"
},
@ -306,7 +380,7 @@
},
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.201.0",
"mongodb-client-encryption": "^2.3.0",
"mongodb-client-encryption": ">=2.3.0 <3",
"snappy": "^7.2.2"
},
"peerDependenciesMeta": {
@ -331,13 +405,13 @@
}
},
"node_modules/mongoose": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.0.5.tgz",
"integrity": "sha512-dkW+RSpMczsHGXCmmEzR6W8aanwTnTQlYJkImN3F4DwRQv1HVmmmCd/HopmSdVfrJldpiV3bPPK2zVXLjbd/mA==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.1.0.tgz",
"integrity": "sha512-shoo9z/7o96Ojx69wpJn65+EC+Mt3q1SWTducW+F2Y4ieCXo0lZwpCZedgC841MIvJ7V8o6gmzoN1NfcnOTOuw==",
"dependencies": {
"bson": "^5.0.1",
"bson": "^5.2.0",
"kareem": "2.5.1",
"mongodb": "5.1.0",
"mongodb": "5.3.0",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
@ -375,6 +449,33 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/node-cron": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.2.tgz",
"integrity": "sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ==",
"dependencies": {
"uuid": "8.3.2"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/peek-readable": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz",
@ -575,6 +676,14 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
@ -595,6 +704,11 @@
"node": ">=12"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
@ -689,9 +803,9 @@
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="
},
"@types/node": {
"version": "18.16.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz",
"integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ=="
"version": "18.16.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.2.tgz",
"integrity": "sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg=="
},
"@types/webidl-conversions": {
"version": "7.0.0",
@ -715,6 +829,20 @@
"@types/node": "*"
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"bson": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-5.2.0.tgz",
@ -728,6 +856,11 @@
"streamsearch": "^1.1.0"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -788,11 +921,38 @@
"token-types": "^5.0.1"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@ -824,12 +984,25 @@
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
"optional": true
},
"mongodb": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.1.0.tgz",
"integrity": "sha512-qgKb7y+EI90y4weY3z5+lIgm8wmexbonz0GalHkSElQXVKtRuwqXuhXKccyvIjXCJVy9qPV82zsinY0W1FBnJw==",
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"bson": "^5.0.1",
"brace-expansion": "^1.1.7"
}
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
},
"mongodb": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.3.0.tgz",
"integrity": "sha512-Wy/sbahguL8c3TXQWXmuBabiLD+iVmz+tOgQf+FwkCjhUIorqbAxRbbz00g4ZoN4sXIPwpAlTANMaGRjGGTikQ==",
"requires": {
"bson": "^5.2.0",
"mongodb-connection-string-url": "^2.6.0",
"saslprep": "^1.0.3",
"socks": "^2.7.1"
@ -845,13 +1018,13 @@
}
},
"mongoose": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.0.5.tgz",
"integrity": "sha512-dkW+RSpMczsHGXCmmEzR6W8aanwTnTQlYJkImN3F4DwRQv1HVmmmCd/HopmSdVfrJldpiV3bPPK2zVXLjbd/mA==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.1.0.tgz",
"integrity": "sha512-shoo9z/7o96Ojx69wpJn65+EC+Mt3q1SWTducW+F2Y4ieCXo0lZwpCZedgC841MIvJ7V8o6gmzoN1NfcnOTOuw==",
"requires": {
"bson": "^5.0.1",
"bson": "^5.2.0",
"kareem": "2.5.1",
"mongodb": "5.1.0",
"mongodb": "5.3.0",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
@ -876,6 +1049,27 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node-cron": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.2.tgz",
"integrity": "sha512-iP8l0yGlNpE0e6q1o185yOApANRe47UPbLf4YxfbiNHt/RU5eBcGB/e0oudruheSf+LQeDMezqC5BVAb5wwRcQ==",
"requires": {
"uuid": "8.3.2"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="
},
"peek-readable": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz",
@ -1008,6 +1202,11 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
@ -1022,6 +1221,11 @@
"webidl-conversions": "^7.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",

View File

@ -2,7 +2,7 @@
"name": "wolfbot",
"version": "1.0.0",
"description": "Counts wolfs",
"main": "client.js",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
@ -10,11 +10,14 @@
"wolf",
"count"
],
"author": "ultimateplayer1999",
"author": "Ultimateplayer1999",
"license": "ISC",
"dependencies": {
"discord.js": "^14.9.0",
"dotenv": "^16.0.3",
"mongoose": "^7.0.5"
"discord.js": "^14.0.3",
"dotenv": "^16.0.0",
"glob": "^7.2.0",
"moment": "^2.29.4",
"mongoose": "^7.1.0",
"node-cron": "^3.0.2"
}
}

View File

@ -9,6 +9,6 @@ Use the following command to initialize the database.
`node dbinit.js`
It will create the needed collection and document and return it in the console output.
Use the output of _id for the search and update operation. The following part is needed for this
If you want to run it yourself, use the output of _id for the search and update operation. The following part is needed for this
"6448db015eed6ed191ef61a1" (This is offcourse an example, yours will be different.
On the cloud hosted version of mongodb, this will be located in `_id: new ObjectId("6448db015eed6ed191ef61a1")`)
On the cloud hosted version of mongodb, this will be located in `_id: new ObjectId("6448db015eed6ed191ef61a1")` via shell output or `_id: ObjectId("6448db015eed6ed191ef61a1")` on the dashboard)