aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/instance/Highlight.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-08-18 22:42:12 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-08-18 22:42:12 -0400
commit2356d2c44736fb83021dacb551625852111c8ce6 (patch)
tree10408d22fdd7a358d2f5c5917c3b59e55aa4c19d /src/lib/models/instance/Highlight.ts
parent8aed6f93f7740c592cbc0e2f9fd3269c05286077 (diff)
downloadtanzanite-2356d2c44736fb83021dacb551625852111c8ce6.tar.gz
tanzanite-2356d2c44736fb83021dacb551625852111c8ce6.tar.bz2
tanzanite-2356d2c44736fb83021dacb551625852111c8ce6.zip
restructure, experimental presence and member automod, fixed bugs probably made some more bugs
Diffstat (limited to 'src/lib/models/instance/Highlight.ts')
-rw-r--r--src/lib/models/instance/Highlight.ts81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/lib/models/instance/Highlight.ts b/src/lib/models/instance/Highlight.ts
deleted file mode 100644
index 5889fad..0000000
--- a/src/lib/models/instance/Highlight.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { type Snowflake } from 'discord.js';
-import { nanoid } from 'nanoid';
-import { type Sequelize } from 'sequelize';
-import { BaseModel } from '../BaseModel.js';
-const { DataTypes } = (await import('sequelize')).default;
-
-export interface HighlightModel {
- pk: string;
- user: Snowflake;
- guild: Snowflake;
- words: HighlightWord[];
- blacklistedChannels: Snowflake[];
- blacklistedUsers: Snowflake[];
-}
-
-export interface HighLightCreationAttributes {
- pk?: string;
- user: Snowflake;
- guild: Snowflake;
- words?: HighlightWord[];
- blacklistedChannels?: Snowflake[];
- blacklistedUsers?: Snowflake[];
-}
-
-export interface HighlightWord {
- word: string;
- regex: boolean;
-}
-
-/**
- * List of words that should cause the user to be notified for if found in the specified guild.
- */
-export class Highlight extends BaseModel<HighlightModel, HighLightCreationAttributes> implements HighlightModel {
- /**
- * The primary key of the highlight.
- */
- public declare pk: string;
-
- /**
- * The user that the highlight is for.
- */
- public declare user: Snowflake;
-
- /**
- * The guild to look for highlights in.
- */
- public declare guild: Snowflake;
-
- /**
- * The words to look for.
- */
- public declare words: HighlightWord[];
-
- /**
- * Channels that the user choose to ignore highlights in.
- */
- public declare blacklistedChannels: Snowflake[];
-
- /**
- * Users that the user choose to ignore highlights from.
- */
- public declare blacklistedUsers: Snowflake[];
-
- /**
- * Initializes the model.
- * @param sequelize The sequelize instance.
- */
- public static initModel(sequelize: Sequelize): void {
- Highlight.init(
- {
- pk: { type: DataTypes.STRING, primaryKey: true, defaultValue: nanoid },
- user: { type: DataTypes.STRING, allowNull: false },
- guild: { type: DataTypes.STRING, allowNull: false },
- words: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- blacklistedChannels: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- blacklistedUsers: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] }
- },
- { sequelize }
- );
- }
-}