aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord-akairo/BushClient.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
commite78beed6c7e094ef48aad5d18da01b2bbed4536c (patch)
tree32676793af5f7bdc39d438ff284fa5b959274e96 /src/lib/extensions/discord-akairo/BushClient.ts
parenta3103b629250de3fb97a40a4f9ff7e7ba28f4d16 (diff)
downloadtanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.gz
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.bz2
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.zip
fix: a ton of shit
Diffstat (limited to 'src/lib/extensions/discord-akairo/BushClient.ts')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 43ae139..e46e701 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -42,6 +42,7 @@ import {
} from 'discord.js';
import EventEmitter from 'events';
import { google } from 'googleapis';
+import snakeCase from 'lodash.snakecase';
import path from 'path';
import readline from 'readline';
import type { Options as SequelizeOptions, Sequelize as SequelizeType } from 'sequelize';
@@ -213,7 +214,9 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
allowedMentions: AllowedMentions.users(), // No everyone or role mentions by default
makeCache: Options.cacheWithLimits({}),
failIfNotExists: false,
- rest: { api: 'https://canary.discord.com/api' }
+ rest: { api: 'https://canary.discord.com/api' },
+ // todo: remove this when https://github.com/discordjs/discord.js/pull/7497 is merged
+ jsonTransformer
});
patch(this);
@@ -542,3 +545,9 @@ enum GatewayIntentBits {
DirectMessageTyping = 16384,
GuildScheduledEvents = 65536
}
+
+function jsonTransformer(obj: any): any {
+ if (typeof obj !== 'object' || !obj) return obj;
+ if (Array.isArray(obj)) return obj.map(jsonTransformer);
+ return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), jsonTransformer(value)]));
+}