mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Some fixes and cleanup
This commit is contained in:
parent
338855de15
commit
7f0833f699
3 changed files with 19 additions and 13 deletions
|
@ -10,6 +10,7 @@ import {
|
||||||
findRelevantAuditLogEntry,
|
findRelevantAuditLogEntry,
|
||||||
noop,
|
noop,
|
||||||
stripObjectToScalars,
|
stripObjectToScalars,
|
||||||
|
unknownUser,
|
||||||
useMediaUrls,
|
useMediaUrls,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import DefaultLogMessages from "../data/DefaultLogMessages.json";
|
import DefaultLogMessages from "../data/DefaultLogMessages.json";
|
||||||
|
@ -35,12 +36,6 @@ interface ILogChannelMap {
|
||||||
[channelId: string]: ILogChannel;
|
[channelId: string]: ILogChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unknownUser = {
|
|
||||||
id: 0,
|
|
||||||
username: "Unknown",
|
|
||||||
discriminator: "0000",
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IChannelConfig {
|
interface IChannelConfig {
|
||||||
include?: string[];
|
include?: string[];
|
||||||
exclude?: string[];
|
exclude?: string[];
|
||||||
|
@ -263,10 +258,14 @@ export class LogsPlugin extends ZeppelinPlugin<ILogsPluginConfig> {
|
||||||
);
|
);
|
||||||
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : unknownUser;
|
const mod = relevantAuditLogEntry ? relevantAuditLogEntry.user : unknownUser;
|
||||||
|
|
||||||
this.guildLogs.log(LogType.MEMBER_BAN, {
|
this.guildLogs.log(
|
||||||
mod: stripObjectToScalars(mod),
|
LogType.MEMBER_BAN,
|
||||||
user: stripObjectToScalars(user),
|
{
|
||||||
}, user.id);
|
mod: stripObjectToScalars(mod),
|
||||||
|
user: stripObjectToScalars(user),
|
||||||
|
},
|
||||||
|
user.id,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.event("guildBanRemove")
|
@d.event("guildBanRemove")
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
stripObjectToScalars,
|
stripObjectToScalars,
|
||||||
successMessage,
|
successMessage,
|
||||||
trimLines,
|
trimLines,
|
||||||
|
unknownUser,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { GuildMutes } from "../data/GuildMutes";
|
import { GuildMutes } from "../data/GuildMutes";
|
||||||
import { CaseTypes } from "../data/CaseTypes";
|
import { CaseTypes } from "../data/CaseTypes";
|
||||||
|
@ -763,7 +764,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
|
||||||
this.ignoreEvent(IgnoredEventType.Unban, args.userId);
|
this.ignoreEvent(IgnoredEventType.Unban, args.userId);
|
||||||
await this.guild.unbanMember(args.userId);
|
await this.guild.unbanMember(args.userId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
msg.channel.createMessage(errorMessage("Failed to unban member"));
|
msg.channel.createMessage(errorMessage("Failed to unban member; are you sure they're banned?"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,8 +1031,8 @@ export class ModActionsPlugin extends ZeppelinPlugin<IModActionsPluginConfig> {
|
||||||
const normalCases = cases.filter(c => !c.is_hidden);
|
const normalCases = cases.filter(c => !c.is_hidden);
|
||||||
const hiddenCases = cases.filter(c => c.is_hidden);
|
const hiddenCases = cases.filter(c => c.is_hidden);
|
||||||
|
|
||||||
const user = this.bot.users.get(args.userId);
|
const user = this.bot.users.get(args.userId) || unknownUser;
|
||||||
const userName = user ? `${user.username}#${user.discriminator}` : "Unknown#0000";
|
const userName = `${user.username}#${user.discriminator}`;
|
||||||
|
|
||||||
if (cases.length === 0) {
|
if (cases.length === 0) {
|
||||||
msg.channel.createMessage(`No cases found for ${user ? `**${userName}**` : "the specified user"}`);
|
msg.channel.createMessage(`No cases found for ${user ? `**${userName}**` : "the specified user"}`);
|
||||||
|
|
|
@ -494,3 +494,9 @@ export function ucfirst(str) {
|
||||||
if (typeof str !== "string" || str === "") return str;
|
if (typeof str !== "string" || str === "") return str;
|
||||||
return str[0].toUpperCase() + str.slice(1);
|
return str[0].toUpperCase() + str.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const unknownUser = {
|
||||||
|
id: "0",
|
||||||
|
username: "Unknown",
|
||||||
|
discriminator: "0000",
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue