Skip to content

Commit

Permalink
[Update] Now everything works again after code refactoring with @stho32
Browse files Browse the repository at this point in the history
… :D
  • Loading branch information
naseif committed Oct 2, 2021
1 parent ac5e6d1 commit 5506383
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion events/interactionCreate.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
name: "interactionCreate",
once: false,
async execute(interaction) {
async execute(interaction, client) {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
Expand Down
2 changes: 1 addition & 1 deletion events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { prefix } = require("../config.json");

module.exports = {
name: "messageCreate",
async run(message) {
async run(message, client) {
if (message.author.bot) return;
if (!message.guild) return;

Expand Down
8 changes: 4 additions & 4 deletions modules/commandsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ let commandsHelper = function () {
const event = require(`${eventFolder}/${file}`);
if (event.run) {
if (event.once) {
client.once(event.name, (...args) => event.run.bind(...args, client));
client.once(event.name, (...args) => event.run(...args, client));
console.log(`Registered Run Once: ${event.name}`);
} else {
client.on(event.name, (...args) => event.run.bind(...args, client));
client.on(event.name, (...args) => event.run(...args, client));
console.log(`Registered Run On: ${event.name}`);
}
} else {
if (event.once) {
client.once(event.name, (...args) => event.execute.bind(...args, client));
client.once(event.name, (...args) => event.execute(...args, client));
console.log(`Registered Once: ${event.name}`);
} else {
client.on(event.name, (...args) => event.execute.bind(...args, client));
client.on(event.name, (...args) => event.execute(...args, client));
console.log(`Registered On: ${event.name}`);
}
}
Expand Down

0 comments on commit 5506383

Please sign in to comment.