mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
Formatted code
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { Message, CommandInteraction, Interaction } from "discord.js";
|
||||
import { I18n } from "i18n";
|
||||
import { Message, CommandInteraction, Interaction } from 'discord.js';
|
||||
import { I18n } from 'i18n';
|
||||
|
||||
import DiscordMusicPlayer from "../../providers/DiscordMusicPlayer";
|
||||
import DiscordMusicPlayer from '../../providers/DiscordMusicPlayer';
|
||||
|
||||
import DiscordModule, { HybridInteractionMessage } from "../../utils/DiscordModule";
|
||||
import { makeSuccessEmbed, makeInfoEmbed, makeErrorEmbed, sendHybridInteractionMessageResponse } from "../../utils/DiscordMessage";
|
||||
import Locale from "../../services/Locale";
|
||||
import DiscordModule, { HybridInteractionMessage } from '../../utils/DiscordModule';
|
||||
import {
|
||||
makeSuccessEmbed,
|
||||
makeInfoEmbed,
|
||||
makeErrorEmbed,
|
||||
sendHybridInteractionMessageResponse
|
||||
} from '../../utils/DiscordMessage';
|
||||
import Locale from '../../services/Locale';
|
||||
|
||||
const EMBEDS = {
|
||||
RESUMED: (data: HybridInteractionMessage, locale: I18n) => {
|
||||
@@ -38,24 +43,22 @@ const EMBEDS = {
|
||||
user: data.getUser()
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default class Resume extends DiscordModule{
|
||||
|
||||
public id = "Discord_MusicPlayer_Resume";
|
||||
public commands = ["resume"];
|
||||
public commandInteractionName = "resume";
|
||||
export default class Resume extends DiscordModule {
|
||||
public id = 'Discord_MusicPlayer_Resume';
|
||||
public commands = ['resume'];
|
||||
public commandInteractionName = 'resume';
|
||||
|
||||
async GuildOnModuleCommand(args: any, message: Message) {
|
||||
await this.run(new HybridInteractionMessage(message), args);
|
||||
}
|
||||
|
||||
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
|
||||
async GuildModuleCommandInteractionCreate(interaction: CommandInteraction) {
|
||||
await this.run(new HybridInteractionMessage(interaction), interaction.options);
|
||||
}
|
||||
|
||||
async run(data: HybridInteractionMessage, args: any) {
|
||||
|
||||
const guild = data.getGuild();
|
||||
const member = data.getMember();
|
||||
|
||||
@@ -66,23 +69,33 @@ export default class Resume extends DiscordModule{
|
||||
const voiceChannel = member.voice.channel;
|
||||
|
||||
if (!voiceChannel)
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.USER_NOT_IN_VOICECHANNEL(data, locale)] });
|
||||
return await sendHybridInteractionMessageResponse(data, {
|
||||
embeds: [EMBEDS.USER_NOT_IN_VOICECHANNEL(data, locale)]
|
||||
});
|
||||
|
||||
const instance = DiscordMusicPlayer.getGuildInstance(guild.id);
|
||||
|
||||
if(!instance)
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.NO_MUSIC_PLAYING(data, locale)] });
|
||||
if (!instance)
|
||||
return await sendHybridInteractionMessageResponse(data, {
|
||||
embeds: [EMBEDS.NO_MUSIC_PLAYING(data, locale)]
|
||||
});
|
||||
|
||||
if(instance.voiceChannel.id !== voiceChannel.id)
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.USER_NOT_IN_SAME_VOICECHANNEL(data, locale)] }, true);
|
||||
if (instance.voiceChannel.id !== voiceChannel.id)
|
||||
return await sendHybridInteractionMessageResponse(
|
||||
data,
|
||||
{ embeds: [EMBEDS.USER_NOT_IN_SAME_VOICECHANNEL(data, locale)] },
|
||||
true
|
||||
);
|
||||
|
||||
if(instance.queue.track.length === 0)
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.NO_MUSIC_PLAYING(data, locale)] });
|
||||
if (instance.queue.track.length === 0)
|
||||
return await sendHybridInteractionMessageResponse(data, {
|
||||
embeds: [EMBEDS.NO_MUSIC_PLAYING(data, locale)]
|
||||
});
|
||||
|
||||
if(!instance.isPaused())
|
||||
if (!instance.isPaused())
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.NOT_PAUSED(data, locale)] });
|
||||
|
||||
instance.resumePlayer();
|
||||
return await sendHybridInteractionMessageResponse(data, { embeds: [EMBEDS.RESUMED(data, locale)] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user