Added types for subcommands

This commit is contained in:
2025-01-12 19:40:20 +01:00
parent 53914fa9dd
commit 560ad899f8
19 changed files with 81 additions and 42 deletions

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function leave(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
const player = useMainPlayer()
const queue = player.queues.get(interaction.guildId!)
if (!queue) {
@@ -23,3 +23,5 @@ export default async function leave(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function nowplaying(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const player = useMainPlayer()
@@ -56,3 +56,5 @@ export default async function nowplaying(interaction: ChatInputCommandInteractio
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function pause(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const player = useMainPlayer()
@@ -36,3 +36,5 @@ export default async function pause(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,9 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction, GuildMember } from "discord.js"
import { GuildMember } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function play(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const query = interaction.options.getString("query")!
const channel = (interaction.member as GuildMember).voice.channel
@@ -41,3 +42,5 @@ export default async function play(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function queue(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const player = useMainPlayer()
const queue = player.queues.get(interaction.guildId!)
@@ -37,3 +37,5 @@ export default async function queue(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function skip(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const amount = interaction.options.getNumber("amount") ?? 1
@@ -42,3 +42,5 @@ export default async function skip(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function pause(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const player = useMainPlayer()
@@ -36,3 +36,5 @@ export default async function pause(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd

View File

@@ -1,8 +1,8 @@
import { useMainPlayer } from "discord-player"
import { ChatInputCommandInteraction } from "discord.js"
import { embedColor } from "~/config/options.js"
import { SubCommand } from "~/typings"
export default async function volume(interaction: ChatInputCommandInteraction) {
const cmd: SubCommand = async (interaction) => {
await interaction.deferReply()
const volume = interaction.options.getNumber("volume")!
@@ -27,3 +27,5 @@ export default async function volume(interaction: ChatInputCommandInteraction) {
}]
})
}
export default cmd