forked from Galactic/galactic-bot
further guildOnly restrictions
This commit is contained in:
parent
ce4cc40796
commit
53c5430783
@ -24,7 +24,8 @@ class Commands extends SlashCommand {
|
||||
description: ['List disabled commands'],
|
||||
options: []
|
||||
}],
|
||||
memberPermissions: ['MANAGE_GUILD']
|
||||
memberPermissions: ['MANAGE_GUILD'],
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,15 @@ class SettingsCommand extends SlashCommand {
|
||||
});
|
||||
}
|
||||
|
||||
async execute(interaction) {
|
||||
async execute(invoker) {
|
||||
|
||||
const subcmd = interaction.subcommand.name;
|
||||
const subcmd = invoker.subcommand.name;
|
||||
|
||||
if (subcmd === 'list') return this._listSettings(interaction);
|
||||
if (subcmd === 'list') return this._listSettings(invoker);
|
||||
|
||||
}
|
||||
|
||||
async _listSettings(interaction) {
|
||||
async _listSettings(invoker) {
|
||||
|
||||
const { settings } = this.client.registry;
|
||||
const modules = settings.reduce((acc, setting) => {
|
||||
@ -38,10 +38,9 @@ class SettingsCommand extends SlashCommand {
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const { guild } = interaction;
|
||||
const embed = {
|
||||
title: 'Settings',
|
||||
description: guild.format('SETTINGS_LIST'),
|
||||
description: invoker.format('SETTINGS_LIST'),
|
||||
fields: []
|
||||
};
|
||||
|
||||
@ -53,7 +52,7 @@ class SettingsCommand extends SlashCommand {
|
||||
inline: true
|
||||
});
|
||||
|
||||
return interaction.reply({ embeds: [embed] });
|
||||
return invoker.reply({ embeds: [embed] });
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ class GuildCommand extends SlashCommand {
|
||||
super(client, {
|
||||
name: 'server',
|
||||
description: 'Display server related information',
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class InformationCommand extends SlashCommand {
|
||||
|
||||
async _user(interaction, user) {
|
||||
|
||||
const member = await interaction.guild.memberWrapper(user); //await interaction.guild.members.fetch(user.id).catch(() => null);
|
||||
const member = await interaction.guild?.memberWrapper(user) || null; //await interaction.guild.members.fetch(user.id).catch(() => null);
|
||||
const activities = member?.presence?.activities || [];
|
||||
|
||||
const flags = user.flags || await user.fetchFlags();
|
||||
@ -137,6 +137,8 @@ class InformationCommand extends SlashCommand {
|
||||
async _role(interaction, role) {
|
||||
|
||||
const { guild } = interaction;
|
||||
if (!guild) return { emoji: 'failure', index: 'COMMAND_INFO_GUILDONLY_ROLE' };
|
||||
|
||||
const _members = await guild.members.fetch();
|
||||
const members = _members.filter((member) => member.roles.cache.has(role.id));
|
||||
const embed = {
|
||||
@ -163,6 +165,7 @@ class InformationCommand extends SlashCommand {
|
||||
|
||||
async _channel(interaction, channel) {
|
||||
|
||||
if (!interaction.guild) return { emoji: 'failure', index: 'COMMAND_INFO_GUILDONLY_CHANNEL' };
|
||||
const perms = channel.permissionsFor(interaction.member);
|
||||
if (perms.missing('VIEW_CHANNEL').length) throw new CommandError(interaction, { index: 'ERR_MISSING_PERMISSIONS' });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user