From d72c1d32ebde2b24e1ff073a694f46250020c697 Mon Sep 17 00:00:00 2001 From: GhomKrosmonaute Date: Sun, 27 Oct 2024 21:31:30 +0100 Subject: [PATCH] fixed the button create method --- src/app/button.ts | 10 ++++++---- src/buttons/pagination.native.ts | 6 ++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/button.ts b/src/app/button.ts index a95d5e9..1b5f2a8 100644 --- a/src/app/button.ts +++ b/src/app/button.ts @@ -76,7 +76,7 @@ export interface IButton { * export type BuyButtonParams = [article: string, quantity: number] * ``` */ -export type ButtonParams = Record +export type ButtonParams = Record | null export interface ButtonOptions { key: string @@ -97,14 +97,16 @@ export interface ButtonOptions { * Represents a button handler.
* See the {@link https://ghom.gitbook.io/bot.ts/usage/create-a-button guide} for more information. */ -export class Button { +export class Button { filepath?: string native = false constructor(public options: ButtonOptions) {} - public create(params: Params): discord.ButtonBuilder { - return createButton(this, params) + public create(): discord.ButtonBuilder + public create(params: Params): discord.ButtonBuilder + public create(params?: Params): discord.ButtonBuilder { + return createButton(this, params!) } } diff --git a/src/buttons/pagination.native.ts b/src/buttons/pagination.native.ts index 63d9e34..2ed7729 100644 --- a/src/buttons/pagination.native.ts +++ b/src/buttons/pagination.native.ts @@ -1,11 +1,9 @@ import * as button from "#src/app/button.ts" import type * as pagination from "#src/app/pagination.ts" -export type PaginationButtonParams = { +export default new button.Button<{ key: pagination.PaginatorKey -} - -export default new button.Button({ +}>({ key: "pagination", description: "The pagination button", async run(interaction, { key }) {