Fixed broken changes

This commit is contained in:
2022-10-05 12:34:19 +07:00
parent c0aae40fbe
commit 3aa76a5895
+15 -10
View File
@@ -2,7 +2,7 @@ import {
EmbedBuilder, EmbedBuilder,
User, User,
MessagePayload, MessagePayload,
MessageOptions, BaseMessageOptions,
GuildTextBasedChannel, GuildTextBasedChannel,
TextChannel, TextChannel,
DMChannel, DMChannel,
@@ -131,17 +131,22 @@ export function makeProcessingEmbed(data: EmbedDataPresets) {
} }
export async function sendMessage( export async function sendMessage(
channel: TextChannel | DMChannel | BaseGuildTextChannel | GuildTextBasedChannel | PartialDMChannel | BaseGuildTextChannel | BaseGuildVoiceChannel, channel:
| TextChannel
| DMChannel
| BaseGuildTextChannel
| GuildTextBasedChannel
| PartialDMChannel
| BaseGuildTextChannel
| BaseGuildVoiceChannel,
user: User | undefined, user: User | undefined,
options: string | MessagePayload | MessageOptions options: string | MessagePayload | BaseMessageOptions
) { ) {
let message; let message;
try { try {
if(channel instanceof BaseGuildVoiceChannel) if (channel instanceof BaseGuildVoiceChannel) message = await (channel as VoiceChannel).send(options);
message = await (channel as VoiceChannel).send(options); else message = await channel.send(options);
else
message = await channel.send(options);
} catch (error) { } catch (error) {
if (typeof user === 'undefined') { if (typeof user === 'undefined') {
return Logger.error( return Logger.error(
@@ -163,7 +168,7 @@ export async function sendMessage(
export async function sendHybridInteractionMessageResponse( export async function sendHybridInteractionMessageResponse(
data: HybridInteractionMessage, data: HybridInteractionMessage,
payload: MessageOptions | InteractionReplyOptions, payload: BaseMessageOptions | InteractionReplyOptions,
replace = false replace = false
): Promise<Message | BaseInteraction | undefined> { ): Promise<Message | BaseInteraction | undefined> {
if (data.isApplicationCommand() || data.isButton() || data.isSelectMenu()) { if (data.isApplicationCommand() || data.isButton() || data.isSelectMenu()) {
@@ -205,14 +210,14 @@ export async function sendHybridInteractionMessageResponse(
return message; return message;
} }
} }
} else if (data.isMessage()) return await sendReply(data.getMessage(), payload as MessageOptions); } else if (data.isMessage()) return await sendReply(data.getMessage(), payload as BaseMessageOptions);
} }
export function getEmotes() { export function getEmotes() {
return emotes; return emotes;
} }
async function sendReply(rMessage: Message, options: string | MessagePayload | MessageOptions) { async function sendReply(rMessage: Message, options: string | MessagePayload | BaseMessageOptions) {
let message; let message;
try { try {