dez
dez
DIAdiscord.js - Imagine an app
Created by dez on 3/18/2024 in #djs-questions
import "client" into separate function files
im creating a heat system and with this im adding automatic punishments so i want to make separate files like a "ban.js" thatll take in specific arguments and perform the ban action there to save space in other files. i have the function setup to work in other files however im not sure how to go about importing the discord client so i can actually do the ban. i cant do it the typical module.exports = (client) => {} because i have to export the BanMember function. function code here:
class BanMember {
constructor(guild, userID, banReason) {
this.guild = guild;
this.userID = userID;
this.banReason = banReason;
}

ban() {
//ban function here
}

module.explorts = BanMember;
class BanMember {
constructor(guild, userID, banReason) {
this.guild = guild;
this.userID = userID;
this.banReason = banReason;
}

ban() {
//ban function here
}

module.explorts = BanMember;
BanMember.ban(); being the function that will be used in the other files to execute the ban
10 replies