mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-14 03:50: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',
|
category: 'radio',
|
||||||
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
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) {
|
if(!client.stations) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
content: client.messages.emojis["error"] + client.messages.replace(client.messages.errorToGetPlaylist, {
|
||||||
|
@ -11,10 +11,21 @@ export default {
|
|||||||
if (client.funcs.check(client, interaction, command)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio?.get(interaction.guild?.id);
|
const radio = client.radio?.get(interaction.guild?.id);
|
||||||
|
|
||||||
if(!client.stations) return interaction.reply({
|
if(client.config.maintenanceMode){
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
return interaction.reply({
|
||||||
ephemeral: true
|
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;
|
let index: number = client.stations.findIndex((station: station) => station.name == radio.station.name) + 1;
|
||||||
if(index == client.stations?.length) index = 0;
|
if(index == client.stations?.length) index = 0;
|
||||||
|
@ -11,10 +11,21 @@ export default {
|
|||||||
if (client.funcs.check(client, interaction, command)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio?.get(interaction.guild?.id);
|
const radio = client.radio?.get(interaction.guild?.id);
|
||||||
|
|
||||||
if(!client.stations) return interaction.reply({
|
if(client.config.maintenanceMode){
|
||||||
content: client.messages.emojis["error"] + client.messages.maintenance,
|
return interaction.reply({
|
||||||
ephemeral: true
|
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;
|
let index = client.stations.findIndex((station: station) => station.name == radio.station.name) - 1;
|
||||||
if(index == -1) index = client.stations.length - 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) {
|
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
||||||
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
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
|
//@ts-ignore
|
||||||
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
||||||
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user