aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts10
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts18
2 files changed, 27 insertions, 1 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index eb1fe88..3f1c944 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -10,7 +10,7 @@ import {
roleWithDuration,
snowflake
} from '#args';
-import type {
+import {
BushBaseGuildEmojiManager,
BushChannelManager,
BushClientEvents,
@@ -47,8 +47,10 @@ import type { Options as SequelizeOptions, Sequelize as SequelizeType } from 'se
import { fileURLToPath } from 'url';
import UpdateCacheTask from '../../../tasks/updateCache.js';
import UpdateStatsTask from '../../../tasks/updateStats.js';
+import { HighlightManager } from '../../common/HighlightManager';
import { ActivePunishment } from '../../models/instance/ActivePunishment.js';
import { Guild as GuildModel } from '../../models/instance/Guild.js';
+import { Highlight } from '../../models/instance/Highlight.js';
import { Level } from '../../models/instance/Level.js';
import { ModLog } from '../../models/instance/ModLog.js';
import { Reminder } from '../../models/instance/Reminder.js';
@@ -184,6 +186,11 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
public sentry!: typeof Sentry;
/**
+ * Manages most aspects of the highlight command
+ */
+ public highlightManager = new HighlightManager();
+
+ /**
* @param config The configuration for the bot.
*/
public constructor(config: Config) {
@@ -403,6 +410,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
Level.initModel(this.instanceDB);
StickyRole.initModel(this.instanceDB);
Reminder.initModel(this.instanceDB);
+ Highlight.initModel(this.instanceDB);
await this.instanceDB.sync({ alter: true }); // Sync all tables to fix everything if updated
await this.console.success('startup', `Successfully connected to <<instance database>>.`, false);
} catch (e) {
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index c3739d6..a3ddfed 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -520,6 +520,24 @@ export class BushClientUtil extends ClientUtil {
}
/**
+ * Remove an item from an array. All duplicates will be removed.
+ * @param array The array to remove an element from.
+ * @param value The element to remove from the array.
+ */
+ public removeFromArray<T>(array: T[], value: T): T[] {
+ return this.addOrRemoveFromArray('remove', array, value);
+ }
+
+ /**
+ * Add an item from an array. All duplicates will be removed.
+ * @param array The array to add an element to.
+ * @param value The element to add to the array.
+ */
+ public addToArray<T>(array: T[], value: T): T[] {
+ return this.addOrRemoveFromArray('add', array, value);
+ }
+
+ /**
* Surrounds a string to the begging an end of each element in an array.
* @param array The array you want to surround.
* @param surroundChar1 The character placed in the beginning of the element.