aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:46:27 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-31 13:46:27 -0400
commitedcc0dd0a9228192ff6c4f6d6797dd6238e98f92 (patch)
tree70c3f5436342d7f6b0e81222467d2773a3bb0b33 /src/lib/models
parentb63a6b0cb61f0abf8a946a7f0f04a2a19a31e690 (diff)
downloadtanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.gz
tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.bz2
tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.zip
upgraded to typescript 4.3.5
The reason I had to use getters and setters for the db models is because in the newer version of typescript the properties would be defined at runtime and override the getter and setters that sequalize uses later, causing all the values to be undefined and not being able to save any information.
Diffstat (limited to 'src/lib/models')
-rw-r--r--src/lib/models/ActivePunishment.ts41
-rw-r--r--src/lib/models/BaseModel.ts15
-rw-r--r--src/lib/models/Global.ts36
-rw-r--r--src/lib/models/Guild.ts98
-rw-r--r--src/lib/models/Level.ts20
-rw-r--r--src/lib/models/ModLog.ts41
-rw-r--r--src/lib/models/StickyRole.ts28
7 files changed, 239 insertions, 40 deletions
diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts
index 9fcafbe..c204c9a 100644
--- a/src/lib/models/ActivePunishment.ts
+++ b/src/lib/models/ActivePunishment.ts
@@ -36,31 +36,58 @@ export class ActivePunishment
/**
* The ID of this punishment (no real use just for a primary key)
*/
- id: string;
+ public get id(): string {
+ return null;
+ }
+ public set id(value: string) {}
+
/**
* The type of punishment.
*/
- type: ActivePunishmentType;
+ public get type(): ActivePunishmentType {
+ return null;
+ }
+ public set type(value: ActivePunishmentType) {}
+
/**
* The user who is punished.
*/
- user: Snowflake;
+ public get user(): Snowflake {
+ return null;
+ }
+ public set user(value: Snowflake) {}
+
/**
* The guild they are punished in.
*/
- guild: Snowflake;
+ public get guild(): Snowflake {
+ return null;
+ }
+ public set guild(value: Snowflake) {}
+
/**
* Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles.
*/
- extraInfo: Snowflake;
+ public get extraInfo(): Snowflake {
+ return null;
+ }
+ public set extraInfo(value: Snowflake) {}
+
/**
* The date when this punishment expires (optional).
*/
- expires: Date | null;
+ public get expires(): Date | null {
+ return null;
+ }
+ public set expires(value: Date | null) {}
+
/**
* The reference to the modlog entry.
*/
- modlog: string;
+ public get modlog(): string {
+ return null;
+ }
+ public set modlog(value: string) {}
static initModel(sequelize: Sequelize): void {
ActivePunishment.init(
diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts
index fdbd706..340e0aa 100644
--- a/src/lib/models/BaseModel.ts
+++ b/src/lib/models/BaseModel.ts
@@ -1,6 +1,17 @@
import { Model } from 'sequelize';
export abstract class BaseModel<A, B> extends Model<A, B> {
- public readonly createdAt: Date;
- public readonly updatedAt: Date;
+ /**
+ * The date when the row was created.
+ */
+ public get createdAt(): Date {
+ return null;
+ }
+
+ /**
+ * The date when the row was last updated.
+ */
+ public get updatedAt(): Date {
+ return null;
+ }
}
diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts
index e37ef2b..80f11ca 100644
--- a/src/lib/models/Global.ts
+++ b/src/lib/models/Global.ts
@@ -24,27 +24,51 @@ export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes
/**
* The bot's environment.
*/
- environment: 'production' | 'development' | 'beta';
+ public get environment(): 'production' | 'development' | 'beta' {
+ return null;
+ }
+ public set environment(value: 'production' | 'development' | 'beta') {}
+
/**
* Trusted users.
*/
- superUsers: Snowflake[];
+ public get superUsers(): Snowflake[] {
+ return null;
+ }
+ public set superUsers(value: Snowflake[]) {}
+
/**
* Globally disabled commands.
*/
- disabledCommands: string[];
+ public get disabledCommands(): string[] {
+ return null;
+ }
+ public set disabledCommands(value: string[]) {}
+
/**
* Globally blacklisted users.
*/
- blacklistedUsers: Snowflake[];
+ public get blacklistedUsers(): Snowflake[] {
+ return null;
+ }
+ public set blacklistedUsers(value: Snowflake[]) {}
+
/**
* Guilds blacklisted from using the bot.
*/
- blacklistedGuilds: Snowflake[];
+ public get blacklistedGuilds(): Snowflake[] {
+ return null;
+ }
+ public set blacklistedGuilds(value: Snowflake[]) {}
+
/**
* Channels where the bot is prevented from running.
*/
- blacklistedChannels: Snowflake[];
+ public get blacklistedChannels(): Snowflake[] {
+ return null;
+ }
+ public set blacklistedChannels(value: Snowflake[]) {}
+
static initModel(sequelize: Sequelize): void {
Global.init(
{
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts
index 7a0384c..aac4267 100644
--- a/src/lib/models/Guild.ts
+++ b/src/lib/models/Guild.ts
@@ -32,17 +32,93 @@ export interface GuildModelCreationAttributes {
}
export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel {
- id!: Snowflake;
- prefix!: string;
- autoPublishChannels: Snowflake[];
- blacklistedChannels: Snowflake[];
- blacklistedUsers: Snowflake[];
- welcomeChannel: Snowflake;
- muteRole: Snowflake;
- punishmentEnding: string;
- disabledCommands: string[];
- lockdownChannels: Snowflake[];
- autoModPhases: string[];
+ /**
+ * The ID of the guild
+ */
+ public get id(): Snowflake {
+ return null;
+ }
+ public set id(value: Snowflake) {}
+
+ /**
+ * The bot's prefix for the guild
+ */
+ public get prefix(): string {
+ return null;
+ }
+ public set prefix(value: string) {}
+
+ /**
+ * Channels that will have their messages automatically published
+ */
+ public get autoPublishChannels(): Snowflake[] {
+ return null;
+ }
+ public set autoPublishChannels(value: Snowflake[]) {}
+
+ /**
+ * Channels where the bot won't respond in.
+ */
+ public get blacklistedChannels(): Snowflake[] {
+ return null;
+ }
+ public set blacklistedChannels(value: Snowflake[]) {}
+
+ /**
+ * Users that the bot ignores in this guild
+ */
+ public get blacklistedUsers(): Snowflake[] {
+ return null;
+ }
+ public set blacklistedUsers(value: Snowflake[]) {}
+
+ /**
+ * The channels where the welcome messages are sent
+ */
+ public get welcomeChannel(): Snowflake {
+ return null;
+ }
+ public set welcomeChannel(value: Snowflake) {}
+
+ /**
+ * The role given out when muting someone
+ */
+ public get muteRole(): Snowflake {
+ return null;
+ }
+ public set muteRole(value: Snowflake) {}
+
+ /**
+ * The message that gets sent after someone gets a punishment dm
+ */
+ public get punishmentEnding(): string {
+ return null;
+ }
+ public set punishmentEnding(value: string) {}
+
+ /**
+ * Guild specific disabled commands
+ */
+ public get disabledCommands(): string[] {
+ return null;
+ }
+ public set disabledCommands(value: string[]) {}
+
+ /**
+ * Channels that should get locked down when the lockdown command gets used.
+ */
+ public get lockdownChannels(): Snowflake[] {
+ return null;
+ }
+ public set lockdownChannels(value: Snowflake[]) {}
+
+ /**
+ * Custom automod phases
+ */
+ public get autoModPhases(): string[] {
+ return null;
+ }
+ public set autoModPhases(value: string[]) {}
static initModel(sequelize: Sequelize, client: BushClient): void {
Guild.init(
diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts
index 755b1c6..d8b98bf 100644
--- a/src/lib/models/Level.ts
+++ b/src/lib/models/Level.ts
@@ -18,16 +18,28 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> {
/**
* The user's id.
*/
- public user: Snowflake;
+ public get user(): Snowflake {
+ return null;
+ }
+ public set user(value: Snowflake) {}
+
/**
* The guild where the user is gaining xp.
*/
- public guild: Snowflake;
+ public get guild(): Snowflake {
+ return null;
+ }
+ public set guild(value: Snowflake) {}
+
/**
* The user's xp.
*/
- public xp: number;
- get level(): number {
+ public get xp(): number {
+ return null;
+ }
+ public set xp(value: number) {}
+
+ public get level(): number {
return Level.convertXpToLevel(this.xp);
}
diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts
index 3375751..6933432 100644
--- a/src/lib/models/ModLog.ts
+++ b/src/lib/models/ModLog.ts
@@ -44,31 +44,58 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes
/**
* The primary key of the modlog entry.
*/
- id: string;
+ public get id(): string {
+ return null;
+ }
+ public set id(value: string) {}
+
/**
* The type of punishment.
*/
- type: ModLogType;
+ public get type(): ModLogType {
+ return null;
+ }
+ public set type(value: ModLogType) {}
+
/**
* The user being punished.
*/
- user: Snowflake;
+ public get user(): Snowflake {
+ return null;
+ }
+ public set user(value: Snowflake) {}
+
/**
* The user carrying out the punishment.
*/
- moderator: Snowflake;
+ public get moderator(): Snowflake {
+ return null;
+ }
+ public set moderator(value: Snowflake) {}
+
/**
* The reason the user is getting punished
*/
- reason: string | null;
+ public get reason(): string | null {
+ return null;
+ }
+ public set reason(value: string | null) {}
+
/**
* The amount of time the user is getting punished for.
*/
- duration: number | null;
+ public get duration(): number | null {
+ return null;
+ }
+ public set duration(value: number | null) {}
+
/**
* The guild the user is getting punished in.
*/
- guild: Snowflake;
+ public get guild(): Snowflake {
+ return null;
+ }
+ public set guild(value: Snowflake) {}
static initModel(sequelize: Sequelize): void {
ModLog.init(
diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts
index a3928e7..c71ecb7 100644
--- a/src/lib/models/StickyRole.ts
+++ b/src/lib/models/StickyRole.ts
@@ -14,9 +14,31 @@ export interface StickyRoleModelCreationAttributes {
}
export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel {
- user: Snowflake;
- guild: Snowflake;
- roles: Snowflake[];
+ /**
+ * The id of the user the roles belongs to
+ */
+
+ public get user(): Snowflake {
+ return null;
+ }
+ public set user(value: Snowflake) {}
+
+ /**
+ * The guild where this should happen
+ */
+ public get guild(): Snowflake {
+ return null;
+ }
+ public set guild(value: Snowflake) {}
+
+ /**
+ * The roles that the user should have returned
+ */
+ public get roles(): Snowflake[] {
+ return null;
+ }
+ public set roles(value: Snowflake[]) {}
+
static initModel(sequelize: Sequelize): void {
StickyRole.init(
{