All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 3m43s
19 lines
765 B
TypeScript
19 lines
765 B
TypeScript
import type { GuildQueue } from "discord-player"
|
|
import type { PlayerMetadata } from "@/types/player"
|
|
import { stopProgressSaving } from "@/utils/player"
|
|
import { t, getGuildLocale } from "@/utils/i18n"
|
|
|
|
export const name = "emptyChannel"
|
|
export async function execute(queue: GuildQueue<PlayerMetadata>) {
|
|
// Emitted when the voice channel has been empty for the set threshold
|
|
// Bot will automatically leave the voice channel with this event
|
|
await stopProgressSaving(queue.guild.id, queue.player.client.user?.id ?? "")
|
|
|
|
if (!queue.metadata.channel) return
|
|
|
|
if ("send" in queue.metadata.channel) {
|
|
const guildLocale = await getGuildLocale(queue.guild.id)
|
|
return queue.metadata.channel.send({ content: t(guildLocale, "player.leaving_empty_channel") })
|
|
}
|
|
}
|