diff --git a/src/Component/CommandMessage.ts b/src/Component/CommandMessage.ts
index ada19178f..d1b5d1ea6 100644
--- a/src/Component/CommandMessage.ts
+++ b/src/Component/CommandMessage.ts
@@ -16,11 +16,18 @@
* If not, see .
*/
+import type { Message, TextChannel } from "eris";
+
import { CommandMessage as LibCommandMessage } from "@mtripg6666tdr/eris-command-resolver";
import { Util } from "../Util";
export class CommandMessage extends LibCommandMessage {
+ // expose protected method
+ public static override createFromMessageWithParsed(message: Message, command: string, options: string[], rawOptions: string): CommandMessage{
+ return super.createFromMessageWithParsed(message, command, options, rawOptions);
+ }
+
protected static override parseCommand(content:string, prefixLength:number){
const resolved = super.parseCommand(content, prefixLength, Util.string.NormalizeText);
// 超省略形を捕捉
diff --git a/src/Component/PlayManager.ts b/src/Component/PlayManager.ts
index 1dcec7ac0..57594515b 100644
--- a/src/Component/PlayManager.ts
+++ b/src/Component/PlayManager.ts
@@ -301,7 +301,43 @@ export class PlayManager extends ServerManagerBase {
embed.addField(":warning:注意", FallBackNotice);
}
this.emit("playStartUIPrepared", embed);
- mes.edit({content: "", embeds: [embed.toEris()]}).catch(e => Util.logger.log(e, "error"));
+ mes.edit({
+ content: "",
+ embeds: [embed.toEris()],
+ components: [
+ new Helper.MessageActionRowBuilder()
+ .addComponents(
+ new Helper.MessageButtonBuilder()
+ .setCustomId("control_rewind")
+ .setEmoji("⏮️")
+ .setStyle("SECONDARY"),
+ new Helper.MessageButtonBuilder()
+ .setCustomId("control_playpause")
+ .setEmoji("⏯️")
+ .setLabel("再生/一時停止")
+ .setStyle("PRIMARY"),
+ new Helper.MessageButtonBuilder()
+ .setCustomId("control_skip")
+ .setEmoji("⏭️")
+ .setStyle("SECONDARY"),
+ new Helper.MessageButtonBuilder()
+ .setCustomId("control_onceloop")
+ .setEmoji("🔂")
+ .setLabel("ワンスループ")
+ .setStyle("SECONDARY"),
+ )
+ .toEris()
+ ]
+ }).catch(e => Util.logger.log(e, "error"));
+ const removeControls = () => {
+ this.off("playCompleted", removeControls);
+ this.off("error", removeControls);
+ mes.edit({
+ components: []
+ }).catch(er => this.Log(er, "error"));
+ };
+ this.once("playCompleted", removeControls);
+ this.once("error", removeControls);
}
}
catch(e){
diff --git a/src/bot.ts b/src/bot.ts
index c18a77436..6cd8ef6d0 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -357,6 +357,26 @@ export class MusicBot extends MusicBotBase {
components: [],
}).catch(er => this.Log(er, "error"));
}
+ }else if(interaction.data.custom_id.startsWith("control_")){
+ let command:string = null;
+ switch(interaction.data.custom_id){
+ case "control_rewind":
+ command = "rewind";
+ break;
+ case "control_playpause":
+ command = server.player.isPaused ? "play" : "pause";
+ break;
+ case "control_skip":
+ command = "skip";
+ break;
+ case "control_onceloop":
+ command = "onceloop";
+ break;
+ default:
+ return;
+ }
+ const commandMessage = CommandMessage.createFromMessageWithParsed(interaction.message as discord.Message, "command", [], "");
+ CommandManager.instance.resolve(command)?.run(commandMessage, this.createCommandRunnerArgs(commandMessage.guild.id, commandMessage.options, commandMessage.rawOptions));
}else{
const updateEffectPanel = () => {
const mes = interaction.message;