Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!322
This commit is contained in:
@@ -4,9 +4,7 @@ import { IEvent } from "~/interfaces"
|
|||||||
import { dateTimeFormatter } from "~/utils/Functions/intlFormaters.js"
|
import { dateTimeFormatter } from "~/utils/Functions/intlFormaters.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
|
|
||||||
export default {
|
const event: IEvent<"guildMemberAdd"> = (member) => {
|
||||||
event: "guildMemberAdd",
|
|
||||||
execute(member) {
|
|
||||||
if (process.env.NODE_ENV === "dev") return
|
if (process.env.NODE_ENV === "dev") return
|
||||||
logToChannel("bot", {
|
logToChannel("bot", {
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@@ -24,5 +22,6 @@ export default {
|
|||||||
timestamp: new Date().toISOString()
|
timestamp: new Date().toISOString()
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} as IEvent<"guildMemberAdd">
|
|
||||||
|
export default event
|
||||||
|
|||||||
51
src/events/server/interactionCreate/logBtnsCmds.ts
Normal file
51
src/events/server/interactionCreate/logBtnsCmds.ts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { IEvent } from "~/interfaces"
|
||||||
|
import { log } from "~/utils/Logger.js"
|
||||||
|
|
||||||
|
const event: IEvent<"interactionCreate"> = (interaction) => {
|
||||||
|
if (interaction.isChatInputCommand()) {
|
||||||
|
let subcommand: string | null
|
||||||
|
|
||||||
|
try {
|
||||||
|
subcommand = interaction.options.getSubcommand()
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
} catch (e) {
|
||||||
|
subcommand = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subcommand) {
|
||||||
|
log(
|
||||||
|
interaction.user.username + " ran " +
|
||||||
|
interaction.commandName + " " +
|
||||||
|
subcommand,
|
||||||
|
"info",
|
||||||
|
{ type: "preset", color: "pink" }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
log(
|
||||||
|
interaction.user.username + " ran " +
|
||||||
|
interaction.commandName,
|
||||||
|
"info",
|
||||||
|
{ type: "preset", color: "pink" }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interaction.isButton()) {
|
||||||
|
const customId = interaction.customId
|
||||||
|
let btnId: string = ""
|
||||||
|
|
||||||
|
if (customId.startsWith("tempbutton-")) {
|
||||||
|
btnId = customId.split("-")[1]
|
||||||
|
btnId = btnId.split("-")[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
log(
|
||||||
|
interaction.user.username + " clicked " + btnId,
|
||||||
|
"info",
|
||||||
|
{ type: "preset", color: "pink" }
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default event
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
import { IEvent } from "~/interfaces"
|
|
||||||
import { log } from "~/utils/Logger.js"
|
|
||||||
|
|
||||||
export default {
|
|
||||||
event: "interactionCreate",
|
|
||||||
execute(interaction) {
|
|
||||||
if (interaction.isChatInputCommand()) {
|
|
||||||
let subcommand: string | null
|
|
||||||
|
|
||||||
try {
|
|
||||||
subcommand = interaction.options.getSubcommand()
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
} catch (e) {
|
|
||||||
subcommand = null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subcommand) {
|
|
||||||
log(
|
|
||||||
interaction.user.username + " ran " +
|
|
||||||
interaction.commandName + " " +
|
|
||||||
subcommand,
|
|
||||||
"info",
|
|
||||||
{ type: "preset", color: "pink" }
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
log(
|
|
||||||
interaction.user.username + " ran " +
|
|
||||||
interaction.commandName,
|
|
||||||
"info",
|
|
||||||
{ type: "preset", color: "pink" }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (interaction.isButton()) {
|
|
||||||
const customId = interaction.customId
|
|
||||||
let btnId: string = ""
|
|
||||||
|
|
||||||
if (customId.startsWith("tempbutton-")) {
|
|
||||||
btnId = customId.split("-")[1]
|
|
||||||
btnId = btnId.split("-")[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
log(
|
|
||||||
interaction.user.username + " clicked " + btnId,
|
|
||||||
"info",
|
|
||||||
{ type: "preset", color: "pink" }
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} as IEvent<"interactionCreate">
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { ChannelType } from "discord.js"
|
|
||||||
import { IEvent } from "~/interfaces"
|
|
||||||
import env from "~/utils/Env.js"
|
|
||||||
|
|
||||||
export default {
|
|
||||||
event: "messageCreate",
|
|
||||||
async execute(message) {
|
|
||||||
if (message.author.bot) return
|
|
||||||
if (message.author.id !== env.prod.dev) return
|
|
||||||
if (!message.content.startsWith("!eval")) return
|
|
||||||
|
|
||||||
const code = message.content.split(" ").slice(1).join(" ")
|
|
||||||
const channel = message.channel
|
|
||||||
|
|
||||||
if (channel.type !== ChannelType.GuildText) return
|
|
||||||
|
|
||||||
try {
|
|
||||||
const output = eval(code)
|
|
||||||
const outputString = String(output)
|
|
||||||
await channel.send({
|
|
||||||
embeds: [{
|
|
||||||
description: `\`\`\`js\n${outputString}\`\`\``
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
await channel.send({
|
|
||||||
embeds: [{
|
|
||||||
description: `\`\`\`js\n${error}\`\`\``
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} as IEvent<"messageCreate">
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { IEvent } from "~/interfaces"
|
|
||||||
|
|
||||||
export default {
|
|
||||||
event: "messageCreate",
|
|
||||||
async execute(message) {
|
|
||||||
if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") {
|
|
||||||
message.react("Woot:734345936347725885")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} as IEvent<"messageCreate">
|
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import { IEvent } from "~/interfaces"
|
import { IEvent } from "~/interfaces"
|
||||||
import { log } from "~/utils/Logger.js"
|
import { log } from "~/utils/Logger.js"
|
||||||
|
|
||||||
export default {
|
const event: IEvent<"ready"> = (client) => {
|
||||||
event: "ready",
|
|
||||||
execute(client) {
|
|
||||||
log("Logged in as " + client.user!.tag + "!", "info", { type: "preset", color: "green" })
|
log("Logged in as " + client.user!.tag + "!", "info", { type: "preset", color: "green" })
|
||||||
}
|
}
|
||||||
} as IEvent<"ready">
|
|
||||||
|
export default event
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import { embedColor } from "~/config/options.js"
|
|||||||
import { IEvent } from "~/interfaces"
|
import { IEvent } from "~/interfaces"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
|
|
||||||
export default {
|
const event: IEvent<"ready"> = () => {
|
||||||
event: "ready",
|
|
||||||
execute() {
|
|
||||||
if (process.env.NODE_ENV === "dev") return
|
if (process.env.NODE_ENV === "dev") return
|
||||||
|
|
||||||
logToChannel("online", {
|
logToChannel("online", {
|
||||||
@@ -13,5 +11,6 @@ export default {
|
|||||||
color: embedColor
|
color: embedColor
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} as IEvent<"ready">
|
|
||||||
|
export default event
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import { guildid } from "~/config/options.js"
|
|||||||
import statuses from "~/config/statuses.js"
|
import statuses from "~/config/statuses.js"
|
||||||
import { IEvent } from "~/interfaces"
|
import { IEvent } from "~/interfaces"
|
||||||
|
|
||||||
export default {
|
const event: IEvent<"ready"> = (client) => {
|
||||||
event: "ready",
|
|
||||||
execute(client) {
|
|
||||||
const user = client.user!
|
const user = client.user!
|
||||||
const guild = client.guilds.cache.get(guildid) as Guild
|
const guild = client.guilds.cache.get(guildid) as Guild
|
||||||
|
|
||||||
@@ -26,5 +24,6 @@ export default {
|
|||||||
}, 1000 * 60)
|
}, 1000 * 60)
|
||||||
|
|
||||||
user.setStatus("dnd")
|
user.setStatus("dnd")
|
||||||
}
|
}
|
||||||
} as IEvent<"ready">
|
|
||||||
|
export default event
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { IEvent } from "~/interfaces"
|
import { IEvent } from "~/interfaces"
|
||||||
|
|
||||||
export default {
|
const event: IEvent<"voiceStateUpdate"> = (_o, n) => {
|
||||||
event: "voiceStateUpdate",
|
|
||||||
async execute(_o, n) {
|
|
||||||
const guild = n.guild
|
const guild = n.guild
|
||||||
|
|
||||||
if (!guild) return
|
if (!guild) return
|
||||||
@@ -10,5 +8,6 @@ export default {
|
|||||||
if (!n.channel) {
|
if (!n.channel) {
|
||||||
guild.voiceStates.cache.delete(n.id)
|
guild.voiceStates.cache.delete(n.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} as IEvent<"voiceStateUpdate">
|
|
||||||
|
export default event
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { ClientEvents } from "discord.js"
|
import { ClientEvents } from "discord.js"
|
||||||
|
|
||||||
export default interface IEvent<E extends keyof ClientEvents> {
|
type IEvent<E extends keyof ClientEvents> = (...args: ClientEvents[E]) => void
|
||||||
event: E
|
|
||||||
execute(...args: ClientEvents[E]): void
|
export default IEvent
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { IAutocomplete } from "~/interfaces"
|
|||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadAutocompleteEvents(client: Client, ft: FileType) {
|
export default async function loadAutocompleteEvents(client: Client, ft: FileType) {
|
||||||
const autocompletePath = path.join(__dirname, "..", "..", "components", "autocomplete")
|
const autocompletePath = path.join(import.meta.dirname, "..", "..", "components", "autocomplete")
|
||||||
const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(ft))
|
const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of autocompleteFiles) {
|
for (const file of autocompleteFiles) {
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { IButton } from "~/interfaces"
|
|||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadButtonEvents(client: Client, ft: FileType) {
|
export default async function loadButtonEvents(client: Client, ft: FileType) {
|
||||||
const btnPath = path.join(__dirname, "..", "..", "components", "buttons")
|
const btnPath = path.join(import.meta.dirname, "..", "..", "components", "buttons")
|
||||||
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(ft))
|
const btnFiles = fs.readdirSync(btnPath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of btnFiles) {
|
for (const file of btnFiles) {
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { ICommand } from "~/interfaces"
|
|||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
export default async function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||||
const cmdPath = path.join(__dirname, "..", "..", "commands")
|
const cmdPath = path.join(import.meta.dirname, "..", "..", "commands")
|
||||||
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(ft))
|
const cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of cmdFiles) {
|
for (const file of cmdFiles) {
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { IContextMenu } from "~/interfaces"
|
|||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadContextMenuEvents(client: Client, ft: FileType) {
|
export default async function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||||
const contextMenuPath = path.join(__dirname, "..", "..", "commands-contextmenu")
|
const contextMenuPath = path.join(import.meta.dirname, "..", "..", "commands-contextmenu")
|
||||||
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(ft))
|
const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of contextMenuFiles) {
|
for (const file of contextMenuFiles) {
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ import fs from "fs"
|
|||||||
import path from "path"
|
import path from "path"
|
||||||
import { ICron } from "~/interfaces"
|
import { ICron } from "~/interfaces"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadCronEvents(ft: FileType) {
|
export default async function loadCronEvents(ft: FileType) {
|
||||||
const cronPath = path.join(__dirname, "..", "..", "events", "cron")
|
const cronPath = path.join(import.meta.dirname, "..", "..", "events", "cron")
|
||||||
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(ft))
|
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of cronFiles) {
|
for (const file of cronFiles) {
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
|
|
||||||
export default async function loadEvents(client: Client, ft: FileType) {
|
export default async function loadEvents(client: Client, ft: FileType) {
|
||||||
const serverDir = path.join(__dirname, "..", "..", "events", "server")
|
const serverDir = path.join(import.meta.dirname, "..", "..", "events", "server")
|
||||||
const eventDirs = fs.readdirSync(serverDir)
|
const eventDirs = fs.readdirSync(serverDir)
|
||||||
for (const eventDir of eventDirs) {
|
for (const eventDir of eventDirs) {
|
||||||
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)).filter(file => file.endsWith(ft))
|
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)).filter(file => file.endsWith(ft))
|
||||||
|
const eventName = eventDir
|
||||||
for (const eventFile of eventFiles) {
|
for (const eventFile of eventFiles) {
|
||||||
const eventPath = path.join(serverDir, eventDir, eventFile)
|
const eventPath = path.join(serverDir, eventDir, eventFile)
|
||||||
const { default: event } = await import("file://" + eventPath)
|
const { default: event } = await import("file://" + eventPath)
|
||||||
if (!event.disabled) {
|
client.on(eventName, event)
|
||||||
client.on(event.event, event.execute)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ import { IModal } from "~/interfaces"
|
|||||||
import { ExtendedClient as Client } from "~/utils/Client.js"
|
import { ExtendedClient as Client } from "~/utils/Client.js"
|
||||||
import logToChannel from "~/utils/Functions/logtochannel.js"
|
import logToChannel from "~/utils/Functions/logtochannel.js"
|
||||||
type FileType = "js" | "ts"
|
type FileType = "js" | "ts"
|
||||||
const __dirname = import.meta.dirname
|
|
||||||
|
|
||||||
export default async function loadModalEvents(client: Client, ft: FileType) {
|
export default async function loadModalEvents(client: Client, ft: FileType) {
|
||||||
const modalPath = path.join(__dirname, "..", "..", "components", "modals")
|
const modalPath = path.join(import.meta.dirname, "..", "..", "components", "modals")
|
||||||
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(ft))
|
const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(ft))
|
||||||
|
|
||||||
for (const file of modalFiles) {
|
for (const file of modalFiles) {
|
||||||
|
|||||||
Reference in New Issue
Block a user