Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'v14-dev' into feature/88-skip-permission
Browse files Browse the repository at this point in the history
  • Loading branch information
takejohn committed Jun 28, 2024
2 parents 4040cbd + ae572c2 commit 49b063b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
9 changes: 9 additions & 0 deletions language/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@
},
"defaultTitle": "${0}'s graph"
},
"loop": {
"name": "loop",
"description": "音楽をループ再生します。",
"mode": {
"track": "現在の曲をループ再生します!",
"queue": "キュー内の曲をループ再生します!",
"off": "ループ再生をオフにしました!"
}
},
"mcSrvlookup": {
"name": "mcsrv_record",
"description": "Lookup SRV Record",
Expand Down
44 changes: 44 additions & 0 deletions packages/player/commands/loop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { SlashCommandBuilder } from 'discord.js';
import { LANG } from 'core';
import { PlayerCommand } from '../PlayerCommand';
import { QueueRepeatMode } from 'discord-player';

module.exports = new PlayerCommand(
new SlashCommandBuilder()
.setName(LANG.commands.loop.name)
.setDescription(LANG.commands.loop.description),

async function (interaction, queue) {
try {
if (queue.repeatMode == QueueRepeatMode.OFF) {
queue.setRepeatMode(QueueRepeatMode.TRACK);
await interaction.reply(LANG.commands.loop.mode.track);
return;
}
if (queue.repeatMode == QueueRepeatMode.TRACK) {
queue.setRepeatMode(QueueRepeatMode.QUEUE);
await interaction.reply(LANG.commands.loop.mode.queue);
return;
}
if (queue.repeatMode == QueueRepeatMode.QUEUE) {
queue.setRepeatMode(QueueRepeatMode.OFF);
await interaction.reply(LANG.commands.loop.mode.off);
return;
}
} catch (e) {
await interaction.reply(`Something went wrong: ${e}`);
return;
}
},
);

/*
declare enum QueueRepeatMode {
OFF = 0,
TRACK = 1,
QUEUE = 2,
AUTOPLAY = 3
}
*/
1 change: 1 addition & 0 deletions packages/player/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PlayerFeature extends Feature {
require('./commands/skip'),
require('./commands/stop'),
require('./commands/volume'),
require('./commands/loop'),
]);

player.events.on('playerStart', (queue, track) => {
Expand Down

0 comments on commit 49b063b

Please sign in to comment.