aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/extensions/discord-akairo/TanzaniteClient.ts7
-rw-r--r--lib/utils/BotClientUtils.ts5
-rw-r--r--lib/utils/UpdateCache.ts2
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/extensions/discord-akairo/TanzaniteClient.ts b/lib/extensions/discord-akairo/TanzaniteClient.ts
index 24ce962..fe34b58 100644
--- a/lib/extensions/discord-akairo/TanzaniteClient.ts
+++ b/lib/extensions/discord-akairo/TanzaniteClient.ts
@@ -347,13 +347,16 @@ export class TanzaniteClient<Ready extends boolean = boolean> extends AkairoClie
logging: this.config.logging.db ? (sql) => this.logger.debug(sql) : false,
timezone: 'America/New_York'
};
+
+ const prefix = this.config.db.databasePrefix;
+
this.instanceDB = new Sequelize({
...sharedDBOptions,
- database: this.config.isDevelopment ? 'bushbot-dev' : this.config.isBeta ? 'bushbot-beta' : 'bushbot'
+ database: this.config.isDevelopment ? `${prefix}-dev` : this.config.isBeta ? `${prefix}-beta` : prefix
});
this.sharedDB = new Sequelize({
...sharedDBOptions,
- database: 'bushbot-shared'
+ database: `${prefix}-shared`
});
this.sentry = Sentry;
diff --git a/lib/utils/BotClientUtils.ts b/lib/utils/BotClientUtils.ts
index a251bdf..1dd46bf 100644
--- a/lib/utils/BotClientUtils.ts
+++ b/lib/utils/BotClientUtils.ts
@@ -469,7 +469,10 @@ export class BotClientUtils {
if (!(channel in channels))
throw new TypeError(`Invalid channel provided (${channel}), must be one of ${Object.keys(channels).join(' ')}`);
- const channelId = channels[channel];
+ const channelConfig = channels[channel];
+ const environment = this.client.config.environment;
+
+ const channelId = typeof channelConfig === 'string' ? channelConfig : channelConfig[environment];
if (channelId === '') return null;
const res = await this.client.channels.fetch(channelId);
diff --git a/lib/utils/UpdateCache.ts b/lib/utils/UpdateCache.ts
index 2f96d9d..0e39344 100644
--- a/lib/utils/UpdateCache.ts
+++ b/lib/utils/UpdateCache.ts
@@ -14,7 +14,7 @@ export async function updateGlobalCache(client: Client) {
}
export async function updateSharedCache(client: Client) {
- const row: { [x: string]: any } = ((await Shared.findByPk(0)) ?? (await Shared.create())).toJSON();
+ const row: { [x: string]: any } = ((await Shared.findByPk(0)) ?? (await Shared.create({ primaryKey: 0 }))).toJSON();
for (const option in row) {
if (Object.keys(client.cache.shared).includes(option)) {