From a61f61485dbb34441da00203a50e13e8ed385e82 Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+Tarrgon@users.noreply.github.com> Date: Sat, 31 May 2025 11:15:37 -0400 Subject: [PATCH] Add button handlers --- src/buttons/records-next.ts | 15 +++++++++++++++ src/buttons/records-previous.ts | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/buttons/records-next.ts create mode 100644 src/buttons/records-previous.ts diff --git a/src/buttons/records-next.ts b/src/buttons/records-next.ts new file mode 100644 index 0000000..a2ae9b5 --- /dev/null +++ b/src/buttons/records-next.ts @@ -0,0 +1,15 @@ +import { ButtonInteraction, Client } from 'discord.js'; +import { getRecordMessageFromDiscordId } from '../utils'; + +export default { + name: 'records-next', + handler: async function (client: Client, interaction: ButtonInteraction, userId: string, page: string) { + await interaction.deferUpdate(); + + const message = await getRecordMessageFromDiscordId(userId, parseInt(page) + 1, interaction.guild!); + + if (!message) return; + + interaction.editReply(message); + } +}; \ No newline at end of file diff --git a/src/buttons/records-previous.ts b/src/buttons/records-previous.ts new file mode 100644 index 0000000..dd54ac1 --- /dev/null +++ b/src/buttons/records-previous.ts @@ -0,0 +1,15 @@ +import { ButtonInteraction, Client} from 'discord.js'; +import { getRecordMessageFromDiscordId } from '../utils'; + +export default { + name: 'records-previous', + handler: async function (client: Client, interaction: ButtonInteraction, userId: string, page: string) { + await interaction.deferUpdate(); + + const message = await getRecordMessageFromDiscordId(userId, parseInt(page) - 1, interaction.guild!); + + if (!message) return; + + interaction.editReply(message); + } +}; \ No newline at end of file