diff --git a/template/.gitignore b/template/.gitignore index 24c718926..7550c4abc 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -1,6 +1,9 @@ .env fileloader.ts +config.json + # Folder made by Kwik db to watch guild command versions db/ -node_modules \ No newline at end of file +node_modules +package-lock.json \ No newline at end of file diff --git a/template/nodejs/Managers/CommandManager.js b/template/nodejs/Managers/CommandManager.js index 770616d43..af78c4907 100644 --- a/template/nodejs/Managers/CommandManager.js +++ b/template/nodejs/Managers/CommandManager.js @@ -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) => { diff --git a/template/nodejs/Managers/EventManager.js b/template/nodejs/Managers/EventManager.js index c954dd9bf..a90a41fc3 100644 --- a/template/nodejs/Managers/EventManager.js +++ b/template/nodejs/Managers/EventManager.js @@ -26,7 +26,7 @@ class EventManager extends EventEmitter { return event(...args); }; }); - return this._events; + return this.allEvents; } } module.exports = EventManager; diff --git a/template/nodejs/Plugins/General/commands/ping.js b/template/nodejs/Plugins/General/commands/ping.js index a4ee73cf8..a63e7c93e 100644 --- a/template/nodejs/Plugins/General/commands/ping.js +++ b/template/nodejs/Plugins/General/commands/ping.js @@ -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; diff --git a/template/nodejs/Structures/BaseCommand.js b/template/nodejs/Structures/BaseCommand.js index 88a32d188..da1ff523f 100644 --- a/template/nodejs/Structures/BaseCommand.js +++ b/template/nodejs/Structures/BaseCommand.js @@ -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); diff --git a/template/nodejs/events/ready.js b/template/nodejs/events/ready.js index d828e60f8..f9fcaf1e3 100644 --- a/template/nodejs/events/ready.js +++ b/template/nodejs/events/ready.js @@ -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); } diff --git a/template/nodejs/index.js b/template/nodejs/index.js index 549e4fbda..247e5c114 100644 --- a/template/nodejs/index.js +++ b/template/nodejs/index.js @@ -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