all repos — simple-discord-music-bot @ 4025dc44c0749f0952822a9facce3b32010871a9

A Discord bot making use of discord.js and play-yt.

src/commands/skip.ts (view raw)

 1import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js';
 2import { getQueue } from '../functions/music';
 3import { getChannel } from '../functions/voice';
 4
 5module.exports = {
 6    data: new SlashCommandBuilder()
 7        .setName('skip')
 8        .setDescription('Skip current track.'),
 9
10    async execute(interaction: ChatInputCommandInteraction) {
11        const channel = await getChannel(interaction);
12        if (typeof channel == 'string')
13            return await interaction.reply({ content: channel, ephemeral: true });
14
15        const queue = getQueue(interaction.guildId);
16        const result = await queue.next();
17        return await interaction.reply({ content: 'Skipped.' });
18    },
19};