Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"globals": "^17.7.0",
"jiti": "^2.7.0",
"prettier": "^3.9.5",
"tsdown": "^0.22.11",
"tsdown": "^0.22.12",
"typescript": "^7.0.2",
"typescript-eslint": "^8.64.0"
}
Expand Down
30 changes: 15 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/client/StelliaClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { pathToFileURL } from "node:url";
import { Client, type ClientOptions, type Interaction } from "discord.js";
import { type ApplicationEmoji, Client, type ClientOptions, type Interaction } from "discord.js";
import { StelliaUtils } from "@client/index.js";
import {
AutoCompleteManager,
Expand Down Expand Up @@ -91,6 +91,10 @@ export class StelliaClient<
await this.utils.initializeCustomEmojis();
};

public getCustomEmoji = (emojiName: keyof EmojiEnum): ApplicationEmoji | undefined => {
return this.utils.getCustomEmoji(String(emojiName));
};

public getGuildsConfiguration = async (): Promise<TGuildsConfig> => {
const chosenEnvironment = process.argv.find((arg) => arg.startsWith("--config"))?.split("=")[1];
if (!chosenEnvironment) {
Expand Down
17 changes: 14 additions & 3 deletions src/client/StelliaUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
type AnySelectMenuInteraction,
ApplicationCommandType,
type ApplicationEmoji,
type AutocompleteInteraction,
type ButtonInteraction,
type ChatInputCommandInteraction,
Expand Down Expand Up @@ -115,7 +116,13 @@ export class StelliaUtils<EmojiEnum extends Record<string, string> = Record<stri
}
};

public getGuildConfiguration = <CustomGuildConfiguration extends GuildConfiguration>(guildId: string): CustomGuildConfiguration | null => {
public getCustomEmoji = (emojiName: string): ApplicationEmoji | undefined => {
return this.client.customEmojis[emojiName];
};

public getGuildConfiguration = <CustomGuildConfiguration extends GuildConfiguration>(
guildId: string
): CustomGuildConfiguration | null => {
if (!this.client.environment?.areGuildsConfigurationEnabled || !this.guildsConfiguration) {
return null;
}
Expand Down Expand Up @@ -297,7 +304,9 @@ export class StelliaUtils<EmojiEnum extends Record<string, string> = Record<stri
return;
}

const selectMenu = selectMenuManager.getByCustomId(selectMenuInteraction.customId) || selectMenuManager.getByRegex(selectMenuInteraction.customId);
const selectMenu =
selectMenuManager.getByCustomId(selectMenuInteraction.customId) ||
selectMenuManager.getByRegex(selectMenuInteraction.customId);
if (!selectMenu) {
return;
}
Expand All @@ -320,7 +329,9 @@ export class StelliaUtils<EmojiEnum extends Record<string, string> = Record<stri
}
};

private readonly handleMessageContextMenuInteraction = async (interaction: MessageContextMenuCommandInteraction<"cached">): Promise<void> => {
private readonly handleMessageContextMenuInteraction = async (
interaction: MessageContextMenuCommandInteraction<"cached">
): Promise<void> => {
try {
const contextMenuManager = this.client.managers.contextMenus;
if (!contextMenuManager) {
Expand Down
Loading