aboutsummaryrefslogtreecommitdiff
path: root/lib/models/shared/MemberCount.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/shared/MemberCount.ts')
-rw-r--r--lib/models/shared/MemberCount.ts37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/models/shared/MemberCount.ts b/lib/models/shared/MemberCount.ts
new file mode 100644
index 0000000..200a58e
--- /dev/null
+++ b/lib/models/shared/MemberCount.ts
@@ -0,0 +1,37 @@
+import { DataTypes, Model, type Sequelize } from 'sequelize';
+
+export interface MemberCountModel {
+ timestamp: Date;
+ guildId: string;
+ memberCount: number;
+}
+
+export interface MemberCountCreationAttributes {
+ timestamp?: Date;
+ guildId: string;
+ memberCount: number;
+}
+
+/**
+ * The member count of each guild that the bot is in that have over 100 members.
+ */
+export class MemberCount extends Model<MemberCountModel, MemberCountCreationAttributes> implements MemberCountModel {
+ public declare timestamp: Date;
+ public declare guildId: string;
+ public declare memberCount: number;
+
+ /**
+ * Initializes the model.
+ * @param sequelize The sequelize instance.
+ */
+ public static initModel(sequelize: Sequelize): void {
+ MemberCount.init(
+ {
+ timestamp: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
+ guildId: { type: DataTypes.STRING, allowNull: false },
+ memberCount: { type: DataTypes.BIGINT, allowNull: false }
+ },
+ { sequelize, timestamps: false }
+ );
+ }
+}