Updated all files to new interfaces

This commit is contained in:
2024-02-16 16:03:04 +01:00
parent 137401630e
commit 769c3d12ed
77 changed files with 168 additions and 168 deletions

View File

@@ -1,7 +1,7 @@
import fs from "fs"
import { ExtendedClient } from "./Client"
import env from "./Env"
import { Command } from "interfaces"
import { ICommand } from "interfaces"
import { RESTPostAPIChatInputApplicationCommandsJSONBody } from "discord.js"
import color from "./functions/colors"
type FileType = "js" | "ts"
@@ -20,7 +20,7 @@ export default async function autoDeployCommands(fileType: FileType, client: Ext
}
for (const file of commandFiles) {
const command: Command = require(`../commands/${file}`)
const command: ICommand = require(`../commands/${file}`)
if (command.dev) {
commands.push(command.data.toJSON())
}

View File

@@ -1,15 +1,15 @@
import { Client, Collection, GatewayIntentBits, Partials } from "discord.js"
import color from "./functions/colors"
import { Command, ContextMenu, Button, Modal, Autocomplete } from "interfaces"
import { ICommand, IContextMenu, IButton, IModal, IAutocomplete } from "interfaces"
import env from "./Env"
import autoDeployCommands from "./Autodeploy"
export class ExtendedClient extends Client {
commands: Collection<string, Command> = new Collection()
contextmenus: Collection<string, ContextMenu> = new Collection()
buttons: Collection<string, Button> = new Collection()
modals: Collection<string, Modal> = new Collection()
autocomplete: Collection<string, Autocomplete> = new Collection()
commands: Collection<string, ICommand> = new Collection()
contextmenus: Collection<string, IContextMenu> = new Collection()
buttons: Collection<string, IButton> = new Collection()
modals: Collection<string, IModal> = new Collection()
autocomplete: Collection<string, IAutocomplete> = new Collection()
constructor() {
super({

View File

@@ -1,7 +1,7 @@
import { Env } from "interfaces"
import { IEnv } from "interfaces"
import "dotenv/config"
const env: Env = {
const env: IEnv = {
prod: {
token: process.env.TOKEN,
mongoURI: process.env.MONGOURI,

View File

@@ -1,6 +1,6 @@
import { ExtendedClient as Client } from "utils/Client"
import { embedColor } from "config/options"
import { Autocomplete } from "interfaces"
import { IAutocomplete } from "interfaces"
import { Events } from "discord.js"
import color from "utils/functions/colors"
import path from "path"
@@ -14,7 +14,7 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) {
for (const file of autocompleteFiles) {
const filePath = path.join(autocompletePath, file)
const autocomplete: Autocomplete = require(filePath)
const autocomplete: IAutocomplete = require(filePath)
if ("name" in autocomplete && "execute" in autocomplete) {
client.autocomplete.set(autocomplete.name, autocomplete)

View File

@@ -1,7 +1,7 @@
import { ExtendedClient as Client } from "utils/Client"
import color from "utils/functions/colors"
import { embedColor } from "config/options"
import { Button } from "interfaces"
import { IButton } from "interfaces"
import { Events } from "discord.js"
import path from "path"
import fs from "fs"
@@ -14,7 +14,7 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
for (const file of btnFiles) {
const filePath = path.join(btnPath, file)
const btn: Button = require(filePath)
const btn: IButton = require(filePath)
if ("name" in btn && "execute" in btn) {
client.buttons.set(btn.name, btn)

View File

@@ -1,7 +1,7 @@
import { ExtendedClient as Client } from "utils/Client"
import color from "utils/functions/colors"
import { embedColor } from "config/options"
import { Command } from "interfaces"
import { ICommand } from "interfaces"
import { Events } from "discord.js"
import path from "path"
import fs from "fs"
@@ -14,7 +14,7 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file)
const cmd: Command = require(filePath)
const cmd: ICommand = require(filePath)
if ("data" in cmd && "execute" in cmd) {
client.commands.set(cmd.data.name, cmd)

View File

@@ -1,6 +1,6 @@
import { ExtendedClient as Client } from "utils/Client"
import color from "utils/functions/colors"
import { ContextMenu } from "interfaces"
import { IContextMenu } from "interfaces"
import { embedColor } from "config/options"
import { Events } from "discord.js"
import path from "path"
@@ -14,7 +14,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
for (const file of contextMenuFiles) {
const filePath = path.join(contextMenuPath, file)
const cmd: ContextMenu = require(filePath)
const cmd: IContextMenu = require(filePath)
if ("data" in cmd && "execute" in cmd) {
client.contextmenus.set(cmd.data.name, cmd)

View File

@@ -1,7 +1,7 @@
import { CronJob } from "cron"
import path from "path"
import fs from "fs"
import { Cron } from "interfaces"
import { ICron } from "interfaces"
export default function loadCronEvents() {
const cronPath = path.join(__dirname, "..", "..", "events", "cron")
@@ -9,7 +9,7 @@ export default function loadCronEvents() {
for (const file of cronFiles) {
const filePath = path.join(cronPath, file)
const cron: Cron = require(filePath)
const cron: ICron = require(filePath)
const time =
cron.time.seconds + " " +

View File

@@ -1,5 +1,5 @@
import { ExtendedClient as Client } from "utils/Client"
import { Event } from "interfaces"
import { IEvent } from "interfaces"
import path from "path"
import fs from "fs"
@@ -10,7 +10,7 @@ export default function loadEvents(client: Client) {
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir))
for (const eventFile of eventFiles) {
const eventPath = path.join(serverDir, eventDir, eventFile)
const event: Event = require(eventPath)
const event: IEvent = require(eventPath)
if (!event.disabled) {
client.on(event.event, event.execute)
}

View File

@@ -1,7 +1,7 @@
import { ExtendedClient as Client } from "utils/Client"
import color from "utils/functions/colors"
import { embedColor } from "config/options"
import { Modal } from "interfaces"
import { IModal } from "interfaces"
import { Events } from "discord.js"
import path from "path"
import fs from "fs"
@@ -14,7 +14,7 @@ export default function loadModalEvents(client: Client, ft: FileType) {
for (const file of modalFiles) {
const filePath = path.join(modalPath, file)
const modal: Modal = require(filePath)
const modal: IModal = require(filePath)
if ("name" in modal && "execute" in modal) {
client.modals.set(modal.name, modal)

View File

@@ -1,7 +1,7 @@
import fetch from "axios"
import env from "utils/Env"
import { Player, PlayerData } from "interfaces"
import { Guild, GuildData } from "interfaces"
import { IPlayer, IPlayerData } from "interfaces"
import { IGuild, IGuildData } from "interfaces"
const apikey = env.prod.hypixelapikey
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/"
@@ -44,8 +44,8 @@ async function getIGN(uuid: string): Promise<string | null> {
}
}
async function getPlayer(uuid: string): Promise<PlayerData | null> {
const playerReq: Player = await fetch(hypixel, {
async function getPlayer(uuid: string): Promise<IPlayerData | null> {
const playerReq: IPlayer = await fetch(hypixel, {
params: {
uuid: uuid
},
@@ -61,10 +61,10 @@ async function getPlayer(uuid: string): Promise<PlayerData | null> {
return playerReq.data.player
}
async function getGuild(query: string, type?: GuildQueryType): Promise<GuildData | null> {
async function getGuild(query: string, type?: GuildQueryType): Promise<IGuildData | null> {
const reqType = type ? type : "player"
const guildReq: Guild = await fetch(guild, {
const guildReq: IGuild = await fetch(guild, {
params: {
[reqType]: query
},