aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/moderation/ban.ts2
-rw-r--r--src/commands/moderation/kick.ts2
-rw-r--r--src/commands/moderation/modlog.ts2
-rw-r--r--src/commands/moderation/warn.ts2
-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
-rw-r--r--src/listeners/guild/Unban.ts2
-rw-r--r--src/tasks.ts2
15 files changed, 117 insertions, 111 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 300101b..fc861dc 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,7 +1,7 @@
import { User } from 'discord.js';
import { BotCommand } from '../../lib/extensions/BotCommand';
import { BotMessage } from '../../lib/extensions/BotMessage';
-import { Ban, Modlog, ModlogType } from '../../lib/types/Models';
+import { Ban, Modlog, ModlogType } from '../../lib/models';
import moment from 'moment';
const durationAliases: Record<string, string[]> = {
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 0dc4276..dcd19de 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,6 +1,6 @@
import { BotCommand } from '../../lib/extensions/BotCommand';
import { BotMessage } from '../../lib/extensions/BotMessage';
-import { Modlog, ModlogType } from '../../lib/types/Models';
+import { Modlog, ModlogType } from '../../lib/models';
import { GuildMember } from 'discord.js';
export default class PrefixCommand extends BotCommand {
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index ea35198..dbb101c 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -1,6 +1,6 @@
import { BotCommand } from '../../lib/extensions/BotCommand';
import { Message } from 'discord.js';
-import { Modlog } from '../../lib/types/Models';
+import { Modlog } from '../../lib/models';
import { MessageEmbed } from 'discord.js';
import moment from 'moment';
import { stripIndent } from 'common-tags';
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 676615d..755a036 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -1,7 +1,7 @@
import { GuildMember } from 'discord.js';
import { BotCommand } from '../../lib/extensions/BotCommand';
import { BotMessage } from '../../lib/extensions/BotMessage';
-import { Modlog, ModlogType } from '../../lib/types/Models';
+import { Modlog, ModlogType } from '../../lib/models';
export default class WarnCommand extends BotCommand {
public constructor() {
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;
-}
diff --git a/src/listeners/guild/Unban.ts b/src/listeners/guild/Unban.ts
index 7f85132..63267bd 100644
--- a/src/listeners/guild/Unban.ts
+++ b/src/listeners/guild/Unban.ts
@@ -1,7 +1,7 @@
import { User } from 'discord.js';
import { BotGuild } from '../../lib/extensions/BotGuild';
import { BotListener } from '../../lib/extensions/BotListener';
-import { Ban } from '../../lib/types/Models';
+import { Ban } from '../../lib/models';
export default class CommandBlockedListener extends BotListener {
public constructor() {
diff --git a/src/tasks.ts b/src/tasks.ts
index 3aa07c8..69fe97a 100644
--- a/src/tasks.ts
+++ b/src/tasks.ts
@@ -1,7 +1,7 @@
import { DiscordAPIError } from 'discord.js';
import { Op } from 'sequelize';
import { BotClient } from './lib/extensions/BotClient';
-import { Ban } from './lib/types/Models';
+import { Ban } from './lib/models';
export const BanTask = async (client: BotClient): Promise<void> => {
const rows = await Ban.findAll({