diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-07 23:55:54 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-07 23:55:54 -0500 |
commit | 2bcf6828b67a6eb3c2bbff3892ce5ca53d00e713 (patch) | |
tree | 77d706d1d33c92eab7823c415629d14c0b887960 /src/lib/extensions/discord-akairo | |
parent | c3ae31a7539ecb5455df811a2e1d5603beb5c9ae (diff) | |
download | tanzanite-2bcf6828b67a6eb3c2bbff3892ce5ca53d00e713.tar.gz tanzanite-2bcf6828b67a6eb3c2bbff3892ce5ca53d00e713.tar.bz2 tanzanite-2bcf6828b67a6eb3c2bbff3892ce5ca53d00e713.zip |
started working on highlight command
Diffstat (limited to 'src/lib/extensions/discord-akairo')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 10 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 18 |
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. |