From e3c13df197ecd0e60a491bc578265e51d3a68920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20Vigneault=20=C3=90?= Date: Sat, 11 May 2024 10:14:26 -0400 Subject: [PATCH] ... --- src/class/appClient.ts | 15 +++++++++------ src/commands/banner.ts | 9 +++++---- src/helpers/themeHelper.ts | 28 ++++++++++++++-------------- src/index.ts | 1 + tsconfig.json | 1 - 5 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/class/appClient.ts b/src/class/appClient.ts index 4657b2a..6d3972e 100644 --- a/src/class/appClient.ts +++ b/src/class/appClient.ts @@ -14,11 +14,10 @@ import { Collection, Interaction, ClientEvents, - ThreadChannelType, GatewayIntentBits, Partials } from "discord.js"; -import { client, ytFetch } from ".."; +import { ytFetch } from ".."; import { PathLike } from "fs"; import { Event } from "./event"; import { CommandType } from "../typings/command"; @@ -70,7 +69,7 @@ export class AppClient extends Client { // Commands const coreCommands = await this.getSlashCommandsFromDir(`${__dirname}/../commands/`); const pluginsCommands = await this.registerPlugins(); - + const publics = [...coreCommands?.publics, ...pluginsCommands?.publics]; const privates = [...coreCommands?.privates, ...pluginsCommands?.privates]; @@ -152,7 +151,7 @@ export class AppClient extends Client { try { this.guilds.cache.get(guildId)?.commands.set(commands); console.info(`\nRegistered ${commands.length} commands to ${guildId}`); - } catch {} + } catch { } return; } @@ -208,15 +207,19 @@ export class AppClient extends Client { const command: CommandType = await importFile(filePath); - if (!command.name) continue; + if (!command?.name) { + console.error("Error a command import:"); + console.error(command); + continue; + }; - this.emit('debug', JSON.stringify(command)); this.commands.set(command.name, command); command.public ? publics.push(command) : privates.push(command); } + console.info(dirPath, { publics, privates }) return { publics, privates }; } diff --git a/src/commands/banner.ts b/src/commands/banner.ts index 51a1b0c..c61ca10 100644 --- a/src/commands/banner.ts +++ b/src/commands/banner.ts @@ -34,9 +34,8 @@ export default new Command({ const type = args.getInteger("type", false) ? "goodbye" : "welcome"; const channel = args.getChannel('channel', false, [ChannelType.GuildText]) ?? guild.systemChannel; - - channel.sendTyping(); - interaction.channel.sendTyping(); + + interaction?.channel?.sendTyping(); await sendBanner(member, type, channel); interaction.reply({ content: "Done!", ephemeral: true }); } catch (error) { @@ -53,7 +52,8 @@ export async function sendBanner( interaction?: any) { if (!member || member.user.bot) return; - + + debugger const defConfigs = getGuildConfigsById("default"); const guildConfigs = getGuildConfigsById(member.guild.id) ?? defConfigs; @@ -73,6 +73,7 @@ export async function sendBanner( : member.guild.systemChannel; channel = channelOverride ? channelOverride : channel; + debugger const card = await newCard.render(member, cardData.getTitle(), cardData.getMsg({ member })); return await DiscordManager.guildSend(channel, { content: getContent({ member }), diff --git a/src/helpers/themeHelper.ts b/src/helpers/themeHelper.ts index ee73c31..bd93697 100644 --- a/src/helpers/themeHelper.ts +++ b/src/helpers/themeHelper.ts @@ -1,26 +1,26 @@ +import { PATHS } from ".."; import { getRndInteger } from "./helpers"; export class ThemeHelper { - BackgroundImages = { WelcomerLightStyle: [ - "assets/img/banners/light.png", - "assets/img/banners/light-1.png", - "assets/img/banners/light-2.png", - "assets/img/banners/light-3.png", - "assets/img/banners/light-4.png", + `${PATHS.banners}light.png`, + `${PATHS.banners}light-1.png`, + `${PATHS.banners}light-2.png`, + `${PATHS.banners}light-3.png`, + `${PATHS.banners}light-4.png`, ], WelcomerDarkStyle: [ - "assets/img/banners/dark.png", - "assets/img/banners/dark-1.png", - "assets/img/banners/dark-2.png", - "assets/img/banners/dark-3.png", + `${PATHS.banners}dark.png`, + `${PATHS.banners}dark-1.png`, + `${PATHS.banners}dark-2.png`, + `${PATHS.banners}dark-3.png`, ], WelcomerCustomStyle: [ - "assets/img/banners/custom.png", - "assets/img/banners/custom-1.png", - "assets/img/banners/custom-2.png", - "assets/img/banners/custom-3.png", + `${PATHS.banners}custom.png`, + `${PATHS.banners}custom-1.png`, + `${PATHS.banners}custom-2.png`, + `${PATHS.banners}custom-3.png`, ], } diff --git a/src/index.ts b/src/index.ts index 630348a..d1008ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,7 @@ export const PATHS = { root: `${rootDir}/`, shells: `${rootDir}/shells/`, bashes: `${rootDir}/shells/bash/`, + banners: `${rootDir}/assets/img/banners/` }; export const sentryHelper = new SentryHelper().init(); diff --git a/tsconfig.json b/tsconfig.json index 24168fc..e33d942 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,6 @@ "services", "plugins", "environments.d.ts", - "plugins" ], "exclude": [ "node_modules",