mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-09 23:00:18 +00:00
Limit commands in maintenance mode
This commit is contained in:
parent
3f1d576c44
commit
408c5aaab8
@ -8,6 +8,13 @@ export default {
|
||||
category: 'radio',
|
||||
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
||||
|
||||
if(client.config.maintenanceMode){
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
if(!client.stations) {
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||
|
@ -11,10 +11,21 @@ export default {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
const radio = client.radio?.get(interaction.guild?.id);
|
||||
|
||||
if(!client.stations) return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
if(client.config.maintenanceMode){
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
if(!client.stations) {
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||
"%client.config.supportGuild%": client.config.supportGuild
|
||||
}),
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
let index: number = client.stations.findIndex((station: station) => station.name == radio.station.name) + 1;
|
||||
if(index == client.stations?.length) index = 0;
|
||||
|
@ -11,10 +11,21 @@ export default {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
const radio = client.radio?.get(interaction.guild?.id);
|
||||
|
||||
if(!client.stations) return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
if(client.config.maintenanceMode){
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
if(!client.stations) {
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||
"%client.config.supportGuild%": client.config.supportGuild
|
||||
}),
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
let index = client.stations.findIndex((station: station) => station.name == radio.station.name) - 1;
|
||||
if(index == -1) index = client.stations.length - 1;
|
||||
|
@ -4,13 +4,6 @@ import RadioClient from "../../Client";
|
||||
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
||||
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
||||
|
||||
if(client.config.maintenanceMode){
|
||||
return interaction.reply({
|
||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
||||
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
||||
|
Loading…
Reference in New Issue
Block a user