Changed the event handler

This commit is contained in:
2024-09-16 13:59:19 +02:00
parent 957536fb62
commit 50a70797b4
10 changed files with 20 additions and 54 deletions

View File

@@ -4,10 +4,7 @@ import { IEvent } from "interfaces"
import logToChannel from "utils/functions/logtochannel.js"
export default {
name: "logNewJoins",
description: "Logs new joins",
event: "guildMemberAdd",
execute(member: GuildMember) {
if (process.env.NODE_ENV === "dev") return
logToChannel("bot", {
@@ -27,4 +24,4 @@ export default {
}]
})
}
} as IEvent
} as IEvent<"guildMemberAdd">

View File

@@ -1,14 +1,10 @@
import { ButtonInteraction, ChatInputCommandInteraction } from "discord.js"
import { IEvent } from "interfaces"
import { color } from "utils/functions/colors.js"
export default {
name: "logBtnsCmds",
description: "Logs all button and command interactions",
event: "interactionCreate",
execute(interaction: ChatInputCommandInteraction | ButtonInteraction) {
if (interaction.isCommand()) {
execute(interaction) {
if (interaction.isChatInputCommand()) {
let subcommand: string | null
try {
@@ -60,4 +56,4 @@ export default {
return
}
}
} as IEvent
} as IEvent<"interactionCreate">

View File

@@ -1,14 +1,10 @@
import { ChannelType, Message } from "discord.js"
import { ChannelType } from "discord.js"
import { IEvent } from "interfaces"
import env from "utils/Env.js"
export default {
name: "eval",
description: "Evaluate a JavaScript expression",
event: "messageCreate",
disabled: true,
async execute(message: Message) {
async execute(message) {
if (message.author.bot) return
if (message.author.id !== env.prod.dev) return
if (!message.content.startsWith("!eval")) return
@@ -34,4 +30,4 @@ export default {
})
}
}
} as IEvent
} as IEvent<"messageCreate">

View File

@@ -1,14 +1,10 @@
import { Message } from "discord.js"
import { IEvent } from "interfaces"
export default {
name: "ur mom",
description: "ur moms someone",
event: "messageCreate",
async execute(message: Message) {
async execute(message) {
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
message.react("Woot:734345936347725885")
}
}
} as IEvent
} as IEvent<"messageCreate">

View File

@@ -1,13 +1,9 @@
import { IEvent } from "interfaces"
import { ExtendedClient as Client } from "utils/Client.js"
import { color } from "utils/functions/colors.js"
export default {
name: "conolelog",
description: "console log",
event: "ready",
execute(client: Client) {
execute(client) {
console.log(color("Logged in as " + client.user!.tag + "!", "green"))
}
} as IEvent
} as IEvent<"ready">

View File

@@ -3,10 +3,7 @@ import { IEvent } from "interfaces"
import logToChannel from "utils/functions/logtochannel.js"
export default {
name: "sendonlinemessage",
description: "send an online message",
event: "ready",
execute() {
if (process.env.NODE_ENV === "dev") return
@@ -17,4 +14,4 @@ export default {
}]
})
}
} as IEvent
} as IEvent<"ready">

View File

@@ -2,14 +2,10 @@ import { guildid } from "config/options.js"
import statuses from "config/statuses.js"
import { Guild } from "discord.js"
import { IEvent } from "interfaces"
import { ExtendedClient as Client } from "utils/Client.js"
export default {
name: "status",
description: "Sets the status of the bot",
event: "ready",
execute(client: Client) {
execute(client) {
const user = client.user!
const guild = client.guilds.cache.get(guildid) as Guild
@@ -31,4 +27,4 @@ export default {
user.setStatus("dnd")
}
} as IEvent
} as IEvent<"ready">

View File

@@ -1,12 +1,8 @@
import { VoiceState } from "discord.js"
import { IEvent } from "interfaces"
export default {
name: "updatecache",
description: "Updates the voice states cache",
event: "voiceStateUpdate",
async execute(_o: VoiceState, n: VoiceState) {
async execute(_o, n) {
const guild = n.guild
if (!guild) return
@@ -15,4 +11,4 @@ export default {
guild.voiceStates.cache.delete(n.id)
}
}
} as IEvent
} as IEvent<"voiceStateUpdate">