Open nitplayz opened 2 years ago
In every events it coming undefined instedof objects
code: (event handler)
const fs = require("fs"); const allevents = []; module.exports = async (client) => { const logs = require("discord-logs"); logs(client, { debug: true }) try { try { const stringlength = 69; console.log("\n") console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.brightGreen) console.log(` ┃ `.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length) + "┃".bold.brightGreen) console.log(` The Events handler is starting [events.js] `.bold.blue) console.log(` ┃ `.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length) + "┃".bold.brightGreen) console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.brightGreen) } catch { /* */ } let amount = 0; const load_dir = (dir) => { const event_files = fs.readdirSync(`./events/${dir}`).filter((file) => file.endsWith(".js")); for (const file of event_files) { try { const event = require(`../events/${dir}/${file}`) let eventName = file.split(".")[0]; allevents.push(eventName); client.on(eventName, event.bind(null, client)); amount++; } catch (e) { console.log(e) } } } await ["client", "guild"].forEach(e => load_dir(e)); console.log(`${amount} Events Loaded`.brightGreen); try { const stringlength2 = 69; console.log("\n") console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow) console.log(` ┃ `.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length) + "┃".bold.yellow) console.log(` ┃ `.bold.yellow + `Logging into the BOT...`.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length - `Logging into the BOT...`.length) + "┃".bold.yellow) console.log(` ┃ `.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length) + "┃".bold.yellow) console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow) } catch { /* */ } } catch (e) { console.log(String(e.stack).bgRed) } };
event: (guildMemberRoleAdd)
module.exports = (member, role) => { console.log(member.user.tag+" acquired the role: "+ `${role.name}`); }``` console output
channelUpdate event handler registered. guildUpdate event handler registered. roleUpdate event handler registered. guildMemberUpdate event handler registered. userUpdate event handler registered. messageUpdate event handler registered. presenceUpdate event handler registered. voiceStateUpdate event handler registered
NIKU [.]#0746 acquired the role: undefined NIKU [.]#0746 acquired the role: undefined
And it showing me client name instead of the target name
Try This #164
In every events it coming undefined instedof objects
code: (event handler)
event: (guildMemberRoleAdd)
channelUpdate event handler registered. guildUpdate event handler registered. roleUpdate event handler registered. guildMemberUpdate event handler registered. userUpdate event handler registered. messageUpdate event handler registered. presenceUpdate event handler registered. voiceStateUpdate event handler registered
NIKU [.]#0746 acquired the role: undefined NIKU [.]#0746 acquired the role: undefined