Closed alexx855 closed 2 years ago
`const Discord = require("discord.js"); require('dotenv').config(); const config = process.env;
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
const prefix = "!";
client.on("messageCreate", function (message) { if (message.author.bot) return; if (!message.content.startsWith(prefix)) return;
const commandBody = message.content.slice(prefix.length);
const args = commandBody.split(' ');
const command = args.shift().toLowerCase();
if (command === "ping") {
const timeTaken = Date.now() - message.createdTimestamp;
message.reply(`Pong! This message had a latency of ${timeTaken}ms.`);
}
else if (command === "sum") {
const numArgs = args.map(x => parseFloat(x));
const sum = numArgs.reduce((counter, x) => counter += x);
message.reply(`The sum of all the arguments you provided is ${sum}!`);
}
}); ` what is this?
Sorry i forgot to delete that file, i used it to test only, i was having some random errors on windows 11 so i decided to move to docker and i used that .js file initially to do my first test.
Updated the repository to v14 :'(
Hello, i just did this changes to myself, mainly bc i didn't want to signup and create and account / server on the mongodb cloud platform, hope its helpful for someone, thanks for you job :)