All files / src/modules/bot/music/commands Resume.command.ts

0% Statements 0/10
0% Branches 0/2
0% Functions 0/2
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                                                         
import { CommandConfig, CommandPermissions } from "@/common/decorators";
import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards";
import { CurrentTranslate, TranslationFn, localizationMapByKey } from "@necord/localization";
import { Inject, Logger, UseGuards } from "@nestjs/common";
import { Ctx, SlashCommandContext, Subcommand } from "necord";
import { Music } from "../";
import { MusicCommand } from "../Music.decorator";
import type { IMusicService } from "../interfaces";
 
@MusicCommand()
export class ResumeCommand {
	public constructor(@Inject(Music.Service) private readonly service: IMusicService) {}
 
	private readonly logger = new Logger(ResumeCommand.name);
 
	@Subcommand({
		name: "resume",
		description: "Resumes the music queue",
		nameLocalizations: localizationMapByKey("Music.resume.name"),
		descriptionLocalizations: localizationMapByKey("Music.resume.description"),
	})
	@CommandConfig({ category: "🎵 Music", disable: false })
	@CommandPermissions({
		bot: ["SendMessages"],
		user: ["SendMessages"],
		guildOnly: false,
		ownerOnly: false,
	})
	@UseGuards(CommandConfigGuard, CommandPermissionsGuard)
	public async onCommandRun(@Ctx() [interaction]: SlashCommandContext, @CurrentTranslate() t: TranslationFn) {
		const player = await this.service.getPlayer(interaction);
		if (!(await this.service.checkers(interaction))) return;
		await player.resume();
		return interaction.reply(t("Tools.Music.Resume"));
	}
}