forked from Galactic/galactic-bot
bugfixes
This commit is contained in:
parent
a2b9714aa5
commit
7643256df7
@ -46,7 +46,7 @@ class InformationCommand extends SlashCommand {
|
||||
|
||||
async _user(interaction, user) {
|
||||
|
||||
const member = await interaction.guild?.memberWrapper(user) || null; //await interaction.guild.members.fetch(user.id).catch(() => null);
|
||||
const member = await interaction.guild?.memberWrapper(user).catch(() => null) || null; //await interaction.guild.members.fetch(user.id).catch(() => null);
|
||||
const activities = member?.presence?.activities || [];
|
||||
|
||||
const flags = user.flags || await user.fetchFlags();
|
||||
|
@ -177,8 +177,8 @@ class HistoryCommand extends SlashCommand {
|
||||
|
||||
async _exportLogs(invoker, priv = false) {
|
||||
|
||||
const member = await invoker.memberWrapper();
|
||||
if(!member.isAdmin()) return { emoji: 'failure', index: 'COMMAND_HISTORY_NO_EXPORT_PERMS' };
|
||||
const member = await invoker.memberWrapper().catch(() => null);
|
||||
if(!member || !member.isAdmin()) return { emoji: 'failure', index: 'COMMAND_HISTORY_NO_EXPORT_PERMS' };
|
||||
const logs = await this.client.storageManager.mongodb.infractions.find({ guild: invoker.guild.id }, { projection: { _id: 0 } });
|
||||
const string = JSON.stringify(logs);
|
||||
const attachment = new MessageAttachment(Buffer.from(string), `${invoker.guild.id}-moderation.json`);
|
||||
|
@ -154,7 +154,7 @@ class MuteInfraction extends Infraction {
|
||||
error = false;
|
||||
|
||||
const { removedRoles, muteType, muteRole } = this.data;
|
||||
const member = await this.guild.memberWrapper(this.targetId);
|
||||
const member = await this.guild.memberWrapper(this.targetId).catch(() => null);
|
||||
const callback = await member.getCallback(this.type);
|
||||
if (callback) this.client.moderationManager.removeCallback(callback);
|
||||
|
||||
|
@ -43,7 +43,7 @@ class UnmuteInfraction extends Infraction {
|
||||
now = Date.now();
|
||||
|
||||
let callback = null;
|
||||
const memberWrapper = await this.guild.memberWrapper(this.member);
|
||||
const memberWrapper = await this.guild.memberWrapper(this.member).catch(() => null);
|
||||
if (Object.keys(this.data).length) {
|
||||
removedRoles = this.data.removedRoles; //eslint-disable-line prefer-destructuring
|
||||
muteType = this.data.muteType; //eslint-disable-line prefer-destructuring
|
||||
|
@ -13,8 +13,8 @@ class ChannelIgnore extends Inhibitor {
|
||||
|
||||
async execute(invoker) {
|
||||
|
||||
const member = await invoker.memberWrapper();
|
||||
if (await member.isAdmin()) return super._succeed();
|
||||
const member = await invoker.memberWrapper().catch(() => null);
|
||||
if (!member || await member.isAdmin()) return super._succeed();
|
||||
|
||||
const { guild, channel } = invoker;
|
||||
const settings = await guild.settings();
|
||||
|
@ -17,7 +17,7 @@ class Permissions extends Inhibitor {
|
||||
|
||||
async execute(invoker, command, override = null) {
|
||||
|
||||
const userWrapper = await invoker.memberWrapper();
|
||||
const userWrapper = await invoker.memberWrapper().catch(() => null);
|
||||
if (await userWrapper.isAdmin()) return super._succeed();
|
||||
|
||||
const { guild, member } = invoker;
|
||||
|
@ -406,11 +406,12 @@ class Infraction {
|
||||
timestamp: now,
|
||||
duration: this.duration
|
||||
};
|
||||
const member = await this.guild.memberWrapper(this.target);
|
||||
const callback = await member.getCallback(this.type, true);
|
||||
const member = await this.guild.memberWrapper(this.target).catch(() => null);
|
||||
// const callback = await member.getCallback(this.type, true);
|
||||
const callback = this.client.moderationManager.callbacks.get(this.id);
|
||||
this.duration = duration;
|
||||
|
||||
if (this.data.muteType === 3) {
|
||||
if (this.data.muteType === 3 && member) {
|
||||
const time = this.callback - Date.now();
|
||||
await member.timeout(time < 0 ? null : time, `Duration edit of case ${this.case}`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user