mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
19 lines
559 B
TypeScript
19 lines
559 B
TypeScript
import { ButtonInteraction, Client } from 'discord.js';
|
|
import { Button } from '../types';
|
|
import { getNoteMessage } from '../utils';
|
|
|
|
class NotePreviousButton implements Button<Client> {
|
|
id = 'note-previous';
|
|
|
|
async execute(context: Client<boolean>, interaction: ButtonInteraction, userId: string, page: string): Promise<void> {
|
|
await interaction.deferUpdate();
|
|
|
|
const message = await getNoteMessage(userId, parseInt(page) - 1);
|
|
if (!message) return;
|
|
|
|
await interaction.editReply(message);
|
|
}
|
|
}
|
|
|
|
export default new NotePreviousButton();
|