all repos — simple-discord-music-bot @ 3df93a72ede8d6132fe3d3ccb0ff5f2fdaf949c8

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};