aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
commitc4c1d9ffeb179e208792c88dd099caea5030581b (patch)
treedc075bda115de5f6cec925c398f3c9547d1bad55 /src/lib/extensions/discord-akairo
parentc238b0279c7686ca45506b0909e376f241cf0e30 (diff)
downloadtanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.gz
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.bz2
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.zip
add moderation logging, fixes, hide modlog, jank
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts46
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts9
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts8
3 files changed, 55 insertions, 8 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 5c1cb35..59c4df8 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -1,6 +1,7 @@
import chalk from 'chalk';
import { AkairoClient, ContextMenuCommandHandler } from 'discord-akairo';
import {
+ Awaited,
Collection,
Intents,
InteractionReplyOptions,
@@ -48,6 +49,7 @@ import { BushButtonInteraction } from '../discord.js/BushButtonInteraction';
import { BushCategoryChannel } from '../discord.js/BushCategoryChannel';
import { BushChannel } from '../discord.js/BushChannel';
import { BushChannelManager } from '../discord.js/BushChannelManager';
+import { BushClientEvents } from '../discord.js/BushClientEvents';
import { BushClientUser } from '../discord.js/BushClientUser';
import { BushCommandInteraction } from '../discord.js/BushCommandInteraction';
import { BushDMChannel } from '../discord.js/BushDMChannel';
@@ -159,6 +161,50 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
public logger = BushLogger;
public constants = BushConstants;
public cache = BushCache;
+
+ public override on<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaited<void>
+ ): this;
+ public override on<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaited<void>
+ ): this {
+ return super.on(event as any, listener);
+ }
+
+ public override once<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaited<void>
+ ): this;
+ public override once<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaited<void>
+ ): this {
+ return super.once(event as any, listener);
+ }
+
+ public override emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean;
+ public override emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean {
+ return super.emit(event as any, ...args);
+ }
+
+ public override off<K extends keyof BushClientEvents>(
+ event: K,
+ listener: (...args: BushClientEvents[K]) => Awaited<void>
+ ): this;
+ public override off<S extends string | symbol>(
+ event: Exclude<S, keyof BushClientEvents>,
+ listener: (...args: any[]) => Awaited<void>
+ ): this {
+ return super.off(event as any, listener);
+ }
+
+ public override removeAllListeners<K extends keyof BushClientEvents>(event?: K): this;
+ public override removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this {
+ return super.removeAllListeners(event as any);
+ }
+
public constructor(config: Config) {
super({
ownerID: config.owners,
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 3f9e0b6..fec0174 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -8,6 +8,7 @@ import {
BushGuildResolvable,
BushMessage,
BushSlashMessage,
+ BushUser,
Global,
Guild,
ModLog,
@@ -576,7 +577,7 @@ export class BushClientUtil extends ClientUtil {
if (content.length > 400_000 && !substr) {
void this.handleError('haste', new Error(`content over 400,000 characters (${content.length.toLocaleString()})`));
return { error: 'content too long' };
- } else {
+ } else if (content.length > 400_000) {
content = content.substr(0, 400_000);
isSubstr = true;
}
@@ -876,7 +877,7 @@ export class BushClientUtil extends ClientUtil {
const haste = await this.haste(code, substr);
hasteOut = `Too large to display. ${
haste.url
- ? `Hastebin: ${haste.url}${haste.error ? `(${haste.error})` : ''}`
+ ? `Hastebin: ${haste.url}${haste.error ? ` - ${haste.error}` : ''}`
: `${this.emojis.error} Hastebin: ${haste.error}`
}`;
}
@@ -969,7 +970,7 @@ export class BushClientUtil extends ClientUtil {
public async inspectCleanRedactHaste(input: any, inspectOptions?: BushInspectOptions) {
input = typeof input !== 'string' ? this.inspect(input, inspectOptions ?? undefined) : input;
input = this.redact(input);
- return this.haste(input);
+ return this.haste(input, true);
}
public inspectAndRedact(input: any, inspectOptions?: BushInspectOptions) {
@@ -1413,7 +1414,7 @@ export class BushClientUtil extends ClientUtil {
});
}
- public async resolveNonCachedUser(user: UserResolvable | undefined | null): Promise<User | undefined> {
+ public async resolveNonCachedUser(user: UserResolvable | undefined | null): Promise<BushUser | undefined> {
if (!user) return undefined;
const id =
user instanceof User || user instanceof GuildMember || user instanceof ThreadMember
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index 495a454..1c8ea5b 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -147,7 +147,7 @@ export interface BushCommandOptions extends CommandOptions {
};
args?: BushArgumentOptions[] & CustomBushArgumentOptions[];
category: string;
- completelyHide?: boolean;
+ pseudo?: boolean;
}
export class BushCommand extends Command {
@@ -166,8 +166,8 @@ export class BushCommand extends Command {
/** Whether the command is hidden from the help command. */
public hidden: boolean;
- /** Completely hide this command from the help command. */
- public completelyHide: boolean;
+ /** A fake command, completely hidden from the help command. */
+ public pseudo: boolean;
public constructor(id: string, options: BushCommandOptions) {
if (options.args && typeof options.args !== 'function') {
@@ -184,7 +184,7 @@ export class BushCommand extends Command {
this.hidden = options.hidden ?? false;
this.restrictedChannels = options.restrictedChannels!;
this.restrictedGuilds = options.restrictedGuilds!;
- this.completelyHide = options.completelyHide!;
+ this.pseudo = options.pseudo!;
}
public override exec(message: BushMessage, args: any): any;