Feature/ts #42

Merged
Vylpes merged 10 commits from feature/ts into develop 2021-07-24 12:57:28 +01:00
2 changed files with 69 additions and 20 deletions
Showing only changes of commit e9112ee00e - Show all commits

View file

@ -77,29 +77,32 @@ export class Util {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Load the events
loadEvents(client: Client): IUtilResponse {
// Get the current folder to check
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const folder = process.env.FOLDERS_EVENTS;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// If the folder exists
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (existsSync(`${process.cwd()}/${folder}/`)) {
// Get the files inside of this folder
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const eventFiles = readdirSync(`${process.cwd()}/${folder}/`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Loop through all the files in the folder
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
for (let i = 0; i < eventFiles.length; i++) {
// Ignore non-javascript files
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (eventFiles[i].includes('.ts')) {
// Get the event name, by taking the command file and removing the ".ts" from the end
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const eventName = eventFiles[i].split('.')[0];
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Get the file of the event
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const eventName = eventFiles[i].split('.')[0];
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const file = require(`${process.cwd()}/${folder}/${eventName}.ts`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Initialise the event class
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const event = new file() as Event;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Set the client to emit to this event
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on(eventName, event.execute);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const event = new file[eventName]() as Event;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Load events
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelCreate', event.channelCreate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelDelete', event.channelDelete);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelUpdate', event.channelUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildBanAdd', event.guildBanAdd);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildBanRemove', event.guildBanRemove);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildCreate', event.guildCreate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberAdd', event.guildMemberAdd);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberRemove', event.guildMemberRemove);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberUpdate', event.guildMemberUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('message', event.message);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('messageDelete', event.messageDelete);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('messageUpdate', event.messageUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
}

VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"

View file

@ -1,5 +1,51 @@
export class Event {
public execute() {
import { Channel, Guild, User, GuildMember, Message, PartialDMChannel, PartialGuildMember, PartialMessage } from "discord.js";
}
export class Event {
public channelCreate(channel: Channel) {
}
public channelDelete(channel: Channel | PartialDMChannel) {
}
public channelUpdate(oldChannel: Channel, newChannel: Channel) {
}
public guildBanAdd(guild: Guild, user: User) {
}
public guildBanRemove(guild: Guild, user: User) {
}
public guildCreate(guild: Guild) {
}
public guildMemberAdd(member: GuildMember) {
}
public guildMemberRemove(member: GuildMember | PartialGuildMember) {
}
public guildMemberUpdate(oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) {
}
public message(message: Message) {
}
public messageDelete(message: Message | PartialMessage) {
}
public messageUpdate(oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage) {
}
}