aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/BotClient.ts2
-rw-r--r--src/lib/extensions/BotGuild.ts2
-rw-r--r--src/lib/extensions/BotMessage.ts2
-rw-r--r--src/lib/models/Ban.ts47
-rw-r--r--src/lib/models/BaseModel.ts (renamed from src/lib/types/BaseModel.ts)0
-rw-r--r--src/lib/models/Guild.ts15
-rw-r--r--src/lib/models/Modlog.ts42
-rw-r--r--src/lib/models/index.ts4
-rw-r--r--src/lib/types/Models.ts102
9 files changed, 111 insertions, 105 deletions
diff --git a/src/lib/extensions/BotClient.ts b/src/lib/extensions/BotClient.ts
index 7cc4fec..547d0eb 100644
--- a/src/lib/extensions/BotClient.ts
+++ b/src/lib/extensions/BotClient.ts
@@ -7,7 +7,7 @@ import {
import { Guild } from 'discord.js';
import * as path from 'path';
import { DataTypes, Sequelize } from 'sequelize';
-import * as Models from '../types/Models';
+import * as Models from '../models';
import { BotGuild } from './BotGuild';
import { BotMessage } from './BotMessage';
import { Util } from './Util';
diff --git a/src/lib/extensions/BotGuild.ts b/src/lib/extensions/BotGuild.ts
index 22d7834..bc88ad0 100644
--- a/src/lib/extensions/BotGuild.ts
+++ b/src/lib/extensions/BotGuild.ts
@@ -1,6 +1,6 @@
import { Guild, Structures } from 'discord.js';
import { BotClient } from './BotClient';
-import { Guild as GuildModel } from '../types/Models';
+import { Guild as GuildModel } from '../models';
export class GuildSettings {
private guild: BotGuild;
diff --git a/src/lib/extensions/BotMessage.ts b/src/lib/extensions/BotMessage.ts
index 85c2721..70d4478 100644
--- a/src/lib/extensions/BotMessage.ts
+++ b/src/lib/extensions/BotMessage.ts
@@ -6,7 +6,7 @@ import {
Structures
} from 'discord.js';
import { BotClient } from './BotClient';
-import { Guild as GuildModel } from '../types/Models';
+import { Guild as GuildModel } from '../models';
import { BotGuild } from './BotGuild';
export class GuildSettings {
diff --git a/src/lib/models/Ban.ts b/src/lib/models/Ban.ts
new file mode 100644
index 0000000..032a48b
--- /dev/null
+++ b/src/lib/models/Ban.ts
@@ -0,0 +1,47 @@
+import { BaseModel } from './BaseModel';
+
+export interface BanModel {
+ id: string;
+ user: string;
+ guild: string;
+ reason: string;
+ expires: Date;
+ modlog: string;
+}
+export interface BanModelCreationAttributes {
+ id?: string;
+ user: string;
+ guild: string;
+ reason?: string;
+ expires?: Date;
+ modlog: string;
+}
+
+export class Ban
+ extends BaseModel<BanModel, BanModelCreationAttributes>
+ implements BanModel {
+ /**
+ * The ID of this ban (no real use just for a primary key)
+ */
+ id: string;
+ /**
+ * The user who is banned
+ */
+ user: string;
+ /**
+ * The guild they are banned from
+ */
+ guild: string;
+ /**
+ * The reason they are banned (optional)
+ */
+ reason: string | null;
+ /**
+ * The date at which this ban expires and should be unbanned (optional)
+ */
+ expires: Date | null;
+ /**
+ * The ref to the modlog entry
+ */
+ modlog: string;
+}
diff --git a/src/lib/types/BaseModel.ts b/src/lib/models/BaseModel.ts
index fdbd706..fdbd706 100644
--- a/src/lib/types/BaseModel.ts
+++ b/src/lib/models/BaseModel.ts
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts
new file mode 100644
index 0000000..3e6c6bf
--- /dev/null
+++ b/src/lib/models/Guild.ts
@@ -0,0 +1,15 @@
+import { Optional } from 'sequelize';
+import { BaseModel } from './BaseModel';
+
+export interface GuildModel {
+ id: string;
+ prefix: string;
+}
+export type GuildModelCreationAttributes = Optional<GuildModel, 'prefix'>;
+
+export class Guild
+ extends BaseModel<GuildModel, GuildModelCreationAttributes>
+ implements GuildModel {
+ id: string;
+ prefix: string;
+}
diff --git a/src/lib/models/Modlog.ts b/src/lib/models/Modlog.ts
new file mode 100644
index 0000000..0a3feba
--- /dev/null
+++ b/src/lib/models/Modlog.ts
@@ -0,0 +1,42 @@
+import { BaseModel } from './BaseModel';
+
+export enum ModlogType {
+ BAN = 'BAN',
+ TEMPBAN = 'TEMPBAN',
+ KICK = 'KICK',
+ MUTE = 'MUTE',
+ TEMPMUTE = 'TEMPMUTE',
+ WARN = 'WARN'
+}
+
+export interface ModlogModel {
+ id: string;
+ type: ModlogType;
+ user: string;
+ moderator: string;
+ reason: string;
+ duration: number;
+ guild: string;
+}
+
+export interface ModlogModelCreationAttributes {
+ id?: string;
+ type: ModlogType;
+ user: string;
+ moderator: string;
+ reason?: string;
+ duration?: number;
+ guild: string;
+}
+
+export class Modlog
+ extends BaseModel<ModlogModel, ModlogModelCreationAttributes>
+ implements ModlogModel {
+ id: string;
+ type: ModlogType;
+ user: string;
+ moderator: string;
+ guild: string;
+ reason: string | null;
+ duration: number | null;
+}
diff --git a/src/lib/models/index.ts b/src/lib/models/index.ts
new file mode 100644
index 0000000..ef65415
--- /dev/null
+++ b/src/lib/models/index.ts
@@ -0,0 +1,4 @@
+export * from './BaseModel';
+export * from './Guild';
+export * from './Ban';
+export * from './Modlog';
diff --git a/src/lib/types/Models.ts b/src/lib/types/Models.ts
deleted file mode 100644
index 6ea890e..0000000
--- a/src/lib/types/Models.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import { Optional } from 'sequelize';
-import { BaseModel } from './BaseModel';
-
-export interface GuildModel {
- id: string;
- prefix: string;
-}
-export type GuildModelCreationAttributes = Optional<GuildModel, 'prefix'>;
-
-export class Guild
- extends BaseModel<GuildModel, GuildModelCreationAttributes>
- implements GuildModel {
- id: string;
- prefix: string;
-}
-
-export interface BanModel {
- id: string;
- user: string;
- guild: string;
- reason: string;
- expires: Date;
- modlog: string;
-}
-export interface BanModelCreationAttributes {
- id?: string;
- user: string;
- guild: string;
- reason?: string;
- expires?: Date;
- modlog: string;
-}
-
-export class Ban
- extends BaseModel<BanModel, BanModelCreationAttributes>
- implements BanModel {
- /**
- * The ID of this ban (no real use just for a primary key)
- */
- id: string;
- /**
- * The user who is banned
- */
- user: string;
- /**
- * The guild they are banned from
- */
- guild: string;
- /**
- * The reason they are banned (optional)
- */
- reason: string | null;
- /**
- * The date at which this ban expires and should be unbanned (optional)
- */
- expires: Date | null;
- /**
- * The ref to the modlog entry
- */
- modlog: string;
-}
-
-export enum ModlogType {
- BAN = 'BAN',
- TEMPBAN = 'TEMPBAN',
- KICK = 'KICK',
- MUTE = 'MUTE',
- TEMPMUTE = 'TEMPMUTE',
- WARN = 'WARN'
-}
-
-export interface ModlogModel {
- id: string;
- type: ModlogType;
- user: string;
- moderator: string;
- reason: string;
- duration: number;
- guild: string;
-}
-
-export interface ModlogModelCreationAttributes {
- id?: string;
- type: ModlogType;
- user: string;
- moderator: string;
- reason?: string;
- duration?: number;
- guild: string;
-}
-
-export class Modlog
- extends BaseModel<ModlogModel, ModlogModelCreationAttributes>
- implements ModlogModel {
- id: string;
- type: ModlogType;
- user: string;
- moderator: string;
- guild: string;
- reason: string | null;
- duration: number | null;
-}