Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!329
This commit is contained in:
@@ -37,15 +37,14 @@
|
|||||||
"author": "Taken",
|
"author": "Taken",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discord-player/extractor": "^4.5.1",
|
"@discord-player/extractor": "^7.1.0",
|
||||||
"@evan/opus": "^1.0.3",
|
|
||||||
"@swc/cli": "^0.6.0",
|
"@swc/cli": "^0.6.0",
|
||||||
"@swc/core": "^1.11.5",
|
"@swc/core": "^1.11.5",
|
||||||
"anilist": "^0.12.4",
|
"anilist": "^0.12.4",
|
||||||
"axios": "^1.8.1",
|
"axios": "^1.8.1",
|
||||||
"chalk": "^5.4.1",
|
"chalk": "^5.4.1",
|
||||||
"cron": "^4.1.0",
|
"cron": "^4.1.0",
|
||||||
"discord-player": "^6.7.1",
|
"discord-player": "^7.1.0",
|
||||||
"discord-player-youtubei": "^1.4.2",
|
"discord-player-youtubei": "^1.4.2",
|
||||||
"discord.js": "^14.18.0",
|
"discord.js": "^14.18.0",
|
||||||
"drizzle-orm": "^0.40.0",
|
"drizzle-orm": "^0.40.0",
|
||||||
|
|||||||
980
pnpm-lock.yaml
generated
980
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import nowplaying from "./music/nowplaying.js"
|
|||||||
import pause from "./music/pause.js"
|
import pause from "./music/pause.js"
|
||||||
import play from "./music/play.js"
|
import play from "./music/play.js"
|
||||||
import queue from "./music/queue.js"
|
import queue from "./music/queue.js"
|
||||||
|
import repeat from "./music/repeat.js"
|
||||||
import skip from "./music/skip.js"
|
import skip from "./music/skip.js"
|
||||||
import unpause from "./music/unpause.js"
|
import unpause from "./music/unpause.js"
|
||||||
import volume from "./music/volume.js"
|
import volume from "./music/volume.js"
|
||||||
@@ -54,6 +55,22 @@ export default {
|
|||||||
.setDescription("The amount of songs to skip")
|
.setDescription("The amount of songs to skip")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName("repeat")
|
||||||
|
.setDescription("Set repeat mode")
|
||||||
|
.addStringOption(option =>
|
||||||
|
option
|
||||||
|
.setName("mode")
|
||||||
|
.setDescription("The repeat mode")
|
||||||
|
.addChoices(
|
||||||
|
{ name: "Off", value: "off" },
|
||||||
|
{ name: "Track", value: "track" },
|
||||||
|
{ name: "Queue", value: "queue" }
|
||||||
|
)
|
||||||
|
.setRequired(true)
|
||||||
|
)
|
||||||
|
)
|
||||||
.addSubcommand(subcommand =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("queue")
|
.setName("queue")
|
||||||
@@ -100,6 +117,11 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subcommand === "repeat") {
|
||||||
|
repeat(interaction)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (subcommand === "queue") {
|
if (subcommand === "queue") {
|
||||||
queue(interaction)
|
queue(interaction)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ const cmd: SubCommand = async (interaction) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// const bitRate = channel.bitrate / 1000
|
let replyMessage: string = ""
|
||||||
|
const queue = player.queues.get(interaction.guildId!)
|
||||||
|
|
||||||
const { track } = await player.play(channel, query, {
|
const { track } = await player.play(channel, query, {
|
||||||
requestedBy: interaction.user,
|
requestedBy: interaction.user,
|
||||||
@@ -28,9 +29,15 @@ const cmd: SubCommand = async (interaction) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (queue) {
|
||||||
|
replyMessage = `Added [${track.title}](${track.url}) to the queue`
|
||||||
|
} else {
|
||||||
|
replyMessage = `Playing [${track.title}](${track.url})`
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
description: `Playing [${track.title}](${track.url})`,
|
description: replyMessage,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: track.thumbnail
|
url: track.thumbnail
|
||||||
},
|
},
|
||||||
|
|||||||
40
src/commands/music/repeat.ts
Normal file
40
src/commands/music/repeat.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { QueueRepeatMode, useMainPlayer } from "discord-player"
|
||||||
|
import { embedColor } from "~/config/options.js"
|
||||||
|
import { SubCommand } from "~/typings"
|
||||||
|
|
||||||
|
const QueueRepeatModes = {
|
||||||
|
"off": QueueRepeatMode.OFF,
|
||||||
|
"track": QueueRepeatMode.TRACK,
|
||||||
|
"queue": QueueRepeatMode.QUEUE
|
||||||
|
}
|
||||||
|
|
||||||
|
type RepeatMode = keyof typeof QueueRepeatModes
|
||||||
|
|
||||||
|
const cmd: SubCommand = async (interaction) => {
|
||||||
|
await interaction.deferReply()
|
||||||
|
|
||||||
|
const mode = interaction.options.getString("mode") as RepeatMode
|
||||||
|
const player = useMainPlayer()
|
||||||
|
const queue = player.queues.get(interaction.guildId!)
|
||||||
|
|
||||||
|
if (!queue) {
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: "There is no queue",
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
queue.setRepeatMode(QueueRepeatModes[mode])
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
description: `Repeat mode set to ${mode}`,
|
||||||
|
color: embedColor
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default cmd
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { MissingEnvVarsError } from "./Classes.js"
|
import { MissingEnvVarsError } from "./Classes/EnvVarError.js"
|
||||||
|
|
||||||
const prodEnvSchema = z.object({
|
const prodEnvSchema = z.object({
|
||||||
token: z.string({ message: "Missing or invalid TOKEN" }),
|
token: z.string({ message: "Missing or invalid TOKEN" }),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { DefaultExtractors } from "@discord-player/extractor"
|
||||||
import { Player } from "discord-player"
|
import { Player } from "discord-player"
|
||||||
import { YoutubeiExtractor } from "discord-player-youtubei"
|
import { YoutubeiExtractor } from "discord-player-youtubei"
|
||||||
import { Redis } from "ioredis"
|
import { Redis } from "ioredis"
|
||||||
@@ -20,8 +21,7 @@ if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
|
|||||||
class Illegitimate {
|
class Illegitimate {
|
||||||
async start() {
|
async start() {
|
||||||
await loadAllEvents(client, ft)
|
await loadAllEvents(client, ft)
|
||||||
// await player.extractors.loadDefault()
|
await player.extractors.loadMulti(DefaultExtractors)
|
||||||
await player.extractors.loadDefault(ext => ext != "YouTubeExtractor")
|
|
||||||
await player.extractors.register(YoutubeiExtractor, {})
|
await player.extractors.register(YoutubeiExtractor, {})
|
||||||
await client.start()
|
await client.start()
|
||||||
await this.databases()
|
await this.databases()
|
||||||
|
|||||||
Reference in New Issue
Block a user