aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord.js/BushClientEvents.d.ts24
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts6
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts58
3 files changed, 65 insertions, 23 deletions
diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.d.ts
index d8f1146..4538fbb 100644
--- a/src/lib/extensions/discord.js/BushClientEvents.d.ts
+++ b/src/lib/extensions/discord.js/BushClientEvents.d.ts
@@ -153,7 +153,8 @@ export interface BushClientEvents extends ClientEvents {
reason: string | undefined,
caseID: string,
duration: number,
- dmSuccess?: boolean
+ dmSuccess?: boolean,
+ evidence?: string
];
bushKick: [
victim: BushGuildMember,
@@ -161,7 +162,8 @@ export interface BushClientEvents extends ClientEvents {
guild: BushGuild,
reason: string | undefined,
caseID: string,
- dmSuccess: boolean
+ dmSuccess: boolean,
+ evidence?: string
];
bushMute: [
victim: BushGuildMember,
@@ -170,7 +172,8 @@ export interface BushClientEvents extends ClientEvents {
reason: string | undefined,
caseID: string,
duration: number,
- dmSuccess: boolean
+ dmSuccess: boolean,
+ evidence?: string
];
bushPunishRole: [
victim: BushGuildMember,
@@ -179,7 +182,8 @@ export interface BushClientEvents extends ClientEvents {
reason: string | undefined,
caseID: string,
duration: number,
- role: BushRole
+ role: BushRole,
+ evidence?: string
];
bushPunishRoleRemove: [
victim: BushGuildMember,
@@ -187,7 +191,8 @@ export interface BushClientEvents extends ClientEvents {
guild: BushGuild,
caseID: string,
reason: string | undefined,
- role: BushRole
+ role: BushRole,
+ evidence?: string
];
bushPurge: [
moderator: BushUser,
@@ -201,7 +206,8 @@ export interface BushClientEvents extends ClientEvents {
guild: BushGuild,
reason: string | undefined,
caseID: string,
- dmSuccess: boolean
+ dmSuccess: boolean,
+ evidence?: string
];
bushUnmute: [
victim: BushGuildMember,
@@ -209,7 +215,8 @@ export interface BushClientEvents extends ClientEvents {
guild: BushGuild,
reason: string | undefined,
caseID: string,
- dmSuccess: boolean
+ dmSuccess: boolean,
+ evidence?: string
];
bushUpdateModlog: [
moderator: BushGuildMember,
@@ -231,7 +238,8 @@ export interface BushClientEvents extends ClientEvents {
guild: BushGuild,
reason: string | undefined,
caseID: string,
- dmSuccess: boolean
+ dmSuccess: boolean,
+ evidence?: string
];
bushLevelUpdate: [
member: BushGuildMember,
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index 3a2ae51..8d44cd4 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -76,6 +76,7 @@ export class BushGuild extends Guild {
moderator?: BushUserResolvable;
duration?: number;
deleteDays?: number;
+ evidence?: string;
}): Promise<
'success' | 'missing permissions' | 'error banning' | 'error creating modlog entry' | 'error creating ban entry'
> {
@@ -87,6 +88,8 @@ export class BushGuild extends Guild {
const moderator = (await util.resolveNonCachedUser(options.moderator!)) ?? client.user!;
const ret = await (async () => {
+ await this.members.cache.get(user.id)?.punishDM('banned', options.reason, options.duration ?? 0);
+
// ban
const banSuccess = await this.bans
.create(user?.id ?? options.user, {
@@ -103,7 +106,8 @@ export class BushGuild extends Guild {
moderator: moderator.id,
reason: options.reason,
duration: options.duration,
- guild: this
+ guild: this,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
caseID = modlog.id;
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index b4c136c..954342d 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -10,6 +10,7 @@ import { BushUser } from './BushUser';
interface BushPunishmentOptions {
reason?: string | null;
moderator?: BushGuildMember;
+ evidence?: string;
}
interface BushTimedPunishmentOptions extends BushPunishmentOptions {
@@ -86,7 +87,7 @@ export class BushGuildMember extends GuildMember {
super(client, data, guild);
}
- private async punishDM(punishment: string, reason?: string | null, duration?: number, sendFooter = true): Promise<boolean> {
+ public async punishDM(punishment: string, reason?: string | null, duration?: number, sendFooter = true): Promise<boolean> {
const ending = await this.guild.getSetting('punishmentEnding');
const dmEmbed =
ending && ending.length && sendFooter
@@ -118,7 +119,8 @@ export class BushGuildMember extends GuildMember {
user: this,
moderator: moderator.id,
reason: options.reason,
- guild: this.guild
+ guild: this.guild,
+ evidence: options.evidence
},
true
);
@@ -152,7 +154,8 @@ export class BushGuildMember extends GuildMember {
moderator: moderator.id,
user: this,
reason: 'N/A',
- pseudo: !options.addToModlog
+ pseudo: !options.addToModlog,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
@@ -185,7 +188,8 @@ export class BushGuildMember extends GuildMember {
options.reason ?? undefined,
caseID!,
options.duration ?? 0,
- options.role as BushRole
+ options.role as BushRole,
+ options.evidence
);
return ret;
}
@@ -204,7 +208,8 @@ export class BushGuildMember extends GuildMember {
guild: this.guild,
moderator: moderator.id,
user: this,
- reason: 'N/A'
+ reason: 'N/A',
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
@@ -237,7 +242,8 @@ export class BushGuildMember extends GuildMember {
this.guild,
caseID!,
options.reason ?? undefined,
- options.role as BushRole
+ options.role as BushRole,
+ options.evidence
);
return ret;
}
@@ -288,7 +294,8 @@ export class BushGuildMember extends GuildMember {
moderator: moderator.id,
reason: options.reason,
duration: options.duration,
- guild: this.guild
+ guild: this.guild,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
@@ -323,7 +330,8 @@ export class BushGuildMember extends GuildMember {
options.reason ?? undefined,
caseID!,
options.duration ?? 0,
- dmSuccessEvent!
+ dmSuccessEvent!,
+ options.evidence
);
return ret;
}
@@ -357,7 +365,8 @@ export class BushGuildMember extends GuildMember {
user: this,
moderator: moderator.id,
reason: options.reason,
- guild: this.guild
+ guild: this.guild,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
@@ -382,7 +391,16 @@ export class BushGuildMember extends GuildMember {
})();
if (!['error removing mute role', 'error creating modlog entry', 'error removing mute entry'].includes(ret))
- client.emit('bushUnmute', this, moderator, this.guild, options.reason ?? undefined, caseID!, dmSuccessEvent!);
+ client.emit(
+ 'bushUnmute',
+ this,
+ moderator,
+ this.guild,
+ options.reason ?? undefined,
+ caseID!,
+ dmSuccessEvent!,
+ options.evidence
+ );
return ret;
}
@@ -408,7 +426,8 @@ export class BushGuildMember extends GuildMember {
user: this,
moderator: moderator.id,
reason: options.reason,
- guild: this.guild
+ guild: this.guild,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
caseID = modlog.id;
@@ -416,7 +435,16 @@ export class BushGuildMember extends GuildMember {
return 'success';
})();
if (!['error kicking', 'error creating modlog entry'].includes(ret))
- client.emit('bushKick', this, moderator, this.guild, options.reason ?? undefined, caseID!, dmSuccessEvent!);
+ client.emit(
+ 'bushKick',
+ this,
+ moderator,
+ this.guild,
+ options.reason ?? undefined,
+ caseID!,
+ dmSuccessEvent!,
+ options.evidence
+ );
return ret;
}
@@ -446,7 +474,8 @@ export class BushGuildMember extends GuildMember {
moderator: moderator.id,
reason: options.reason,
duration: options.duration,
- guild: this.guild
+ guild: this.guild,
+ evidence: options.evidence
});
if (!modlog) return 'error creating modlog entry';
caseID = modlog.id;
@@ -473,7 +502,8 @@ export class BushGuildMember extends GuildMember {
options.reason ?? undefined,
caseID!,
options.duration ?? 0,
- dmSuccessEvent!
+ dmSuccessEvent!,
+ options.evidence
);
return ret;
}