fix: nodejs guide template. (#2433)

Co-authored-by: New Author Name <email@address.com>
This commit is contained in:
meister03
2022-09-07 21:00:29 +02:00
committed by GitHub
parent 612f0c8b64
commit a9938b1fcf
7 changed files with 11 additions and 11 deletions

5
template/.gitignore vendored
View File

@@ -1,6 +1,9 @@
.env
fileloader.ts
config.json
# Folder made by Kwik db to watch guild command versions
db/
node_modules
node_modules
package-lock.json

View File

@@ -107,7 +107,7 @@ class CommandManager {
const args = [];
//Map all Values and Args
interaction.data.options.map((o) => {
interaction.data.options?.map((o) => {
if (o.name) args.push(o.name);
if (o.options) {
o.options.map((o2) => {

View File

@@ -26,7 +26,7 @@ class EventManager extends EventEmitter {
return event(...args);
};
});
return this._events;
return this.allEvents;
}
}
module.exports = EventManager;

View File

@@ -10,15 +10,15 @@ class pingcommand extends BaseCommand {
super(data);
}
async execute() {
const msg = await this.reply({ content: `Pinging...` });
const msg = await this.channel.send({ content: `Pinging...` });
//Assign properties to the response
const ping = msg.timestamp - this.message.timestamp;
const ping = msg.timestamp - (this.message ? this.message.timestamp : this.interaction.timestamp);
const embed = new Discord.Embed()
.setTitle(`The Bots ping is ${ping} ms`)
.toJSON();
//Edit Message with the Embed
return msg.edit({ embeds: [embed] });
return this.reply({ embeds: [embed] });
}
}
module.exports = pingcommand;

View File

@@ -1,6 +1,4 @@
const UtilCommand = require("./CommandResponse.js");
const Message = require("./Message.js");
const Interaction = require("./Interaction.js");
class BaseCommand extends UtilCommand {
constructor(data) {
super(data);

View File

@@ -1,7 +1,6 @@
const User = require("../Structures/User");
module.exports = async (client, payload) => {
client.user = client.users.forge(payload.user);
if (payload.shardId + 1 === client.gateway.maxShards) {
if (payload.shardId === client.gateway.lastShardId) {
//All Shards are ready
console.log("Successfully connected to the gateway as " + client.user.tag);
}

View File

@@ -1,7 +1,7 @@
const Discord = require("discordeno.js");
// Ideally you should switch this to .env but for a template a config json is enough
const config = require("../config.json");
const config = require("./config.json");
const EventManager = require("./Managers/EventManager.js");
// looping through all events and registering them