Skip to content

Commit

Permalink
feat: randomLoadingMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
JirayuSrisawat-Github committed Oct 2, 2024
1 parent 1aa1bba commit be8c3f1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/commands/music/play.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ApplyOptions } from "@sapphire/decorators";
import { Command } from "@sapphire/framework";
import { APIEmbed, GuildMember, InteractionResponse } from "discord.js";
import { APIEmbed, GuildMember, Message } from "discord.js";
import { defaultVolume } from "../../config";
import ms from "ms";
import { pickRandom } from "../../lib/utils";
import { RandomLoadingMessage } from "../../lib/constants";

@ApplyOptions<Command.Options>({
// The description of the command.
Expand Down Expand Up @@ -41,7 +43,14 @@ export class UserCommand extends Command {
* @param interaction The interaction that invoked the command.
* @since 1.0.0
*/
public override async chatInputRun(interaction: Command.ChatInputCommandInteraction): Promise<InteractionResponse<boolean> | undefined> {
public override async chatInputRun(interaction: Command.ChatInputCommandInteraction): Promise<Message<boolean>> {
/**
* Sends a loading message to the user.
*/
await interaction.reply({
content: pickRandom(RandomLoadingMessage),
});

/**
* The query to search for.
*/
Expand All @@ -59,7 +68,7 @@ export class UserCommand extends Command {
* If the search result is an error or empty, reply with the error message.
*/
if ("error" === result.loadType || "empty" === result.loadType)
return await interaction.reply({
return await interaction.editReply({
embeds: [
{
color: 0xff0000,
Expand Down Expand Up @@ -118,6 +127,6 @@ export class UserCommand extends Command {
/**
* Sends the embed to the user.
*/
await interaction.reply({ embeds: [embed] });
return await interaction.editReply({ embeds: [embed] });
}
}

0 comments on commit be8c3f1

Please sign in to comment.