Skip to content

Commit

Permalink
make urban embeds map keys a bit more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
TiltedToast committed Feb 24, 2024
1 parent 6434e43 commit e917e43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/commands/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
const { WOLFRAM_ALPHA_APP_ID, EXCHANGE_API_KEY } = process.env;

export const execPromise = promisify(exec);
export const urbanEmbeds: Record<string, EmbedData[]> = {};
export const urbanEmbeds: Record<`${string}-${string}`, EmbedData[]> = {};
const math = create(all);

// eslint-disable-next-line @typescript-eslint/unbound-method
Expand Down Expand Up @@ -567,7 +567,7 @@ export async function urban(input: ChatInputCommandInteraction | Message) {
if (result.list.length === 0) return await sendOrReply(input, "No results found!");

const user = isCommandInteraction(input) ? input.user : input.author;
const identifier = `${user.id}-${input.channelId}`;
const identifier = `${user.id}-${input.channelId}` as const;

if (!urbanEmbeds[identifier]) urbanEmbeds[identifier] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/interactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default async function handleInteraction(interaction: Interaction) {
}

async function handleButtonInteraction(interaction: ButtonInteraction) {
const identifier = `${interaction.user.id}-${interaction.channelId}`;
const identifier = `${interaction.user.id}-${interaction.channelId}` as const;
if ([`prevUrban-${identifier}`, `nextUrban-${identifier}`].includes(interaction.customId)) {
await updateEmbed({
interaction,
Expand Down

0 comments on commit e917e43

Please sign in to comment.