Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Sep 30, 2024
1 parent 23def80 commit 1b11043
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 597 deletions.
10 changes: 7 additions & 3 deletions src/lib/pagination/Pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
type InteractionType,
type Snowflake,
type Interaction,
type InteractionResponse
type InteractionResponse,
type GuildTextBasedChannel,
type DMChannel
} from 'discord.js';

import { PaginationEmbed } from './PaginationEmbed.js';
Expand Down Expand Up @@ -287,8 +289,10 @@ export class Pagination extends PaginationEmbed {
*/
public async send(): Promise<Message> {
const payload = this.ready();
if (!this.interaction.channel) throw new TypeError("The interaction or message don't have a channel");
const message = await this.interaction.channel.send(payload);
if (!this.interaction.channel) throw new Error("The interaction or message don't have a channel");
if (this.interaction.channel.partial) await this.interaction.channel.fetch();
if (this.interaction.channel.partial) throw new Error('The interaction or message has a partial channel');
const message = await (this.interaction.channel as DMChannel | GuildTextBasedChannel).send(payload);
this.paginate(message);
return message;
}
Expand Down
Loading

0 comments on commit 1b11043

Please # to comment.