aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/BotClient.ts4
-rw-r--r--src/lib/extensions/BotGuild.ts38
-rw-r--r--src/lib/extensions/BotMessage.ts50
3 files changed, 0 insertions, 92 deletions
diff --git a/src/lib/extensions/BotClient.ts b/src/lib/extensions/BotClient.ts
index 76b1a1b..bd14fd2 100644
--- a/src/lib/extensions/BotClient.ts
+++ b/src/lib/extensions/BotClient.ts
@@ -8,8 +8,6 @@ import { Guild } from 'discord.js';
import * as path from 'path';
import { Sequelize } from 'sequelize';
import * as Models from '../models';
-import { BotGuild } from './BotGuild';
-import { BotMessage } from './BotMessage';
import { Util } from './Util';
import * as Tasks from '../../tasks';
import { exit } from 'process';
@@ -96,8 +94,6 @@ export class BotClient extends AkairoClient {
logging: false
}
);
- BotGuild.install();
- BotMessage.install();
this.logger = new Logger(this);
}
diff --git a/src/lib/extensions/BotGuild.ts b/src/lib/extensions/BotGuild.ts
deleted file mode 100644
index bc88ad0..0000000
--- a/src/lib/extensions/BotGuild.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Guild, Structures } from 'discord.js';
-import { BotClient } from './BotClient';
-import { Guild as GuildModel } from '../models';
-
-export class GuildSettings {
- private guild: BotGuild;
- constructor(guild: BotGuild) {
- this.guild = guild;
- }
- public async getPrefix(): Promise<string> {
- return await GuildModel.findByPk(this.guild.id).then(
- (gm) => gm?.prefix || this.guild.client.config.prefix
- );
- }
- public async setPrefix(value: string): Promise<void> {
- let entry = await GuildModel.findByPk(this.guild.id);
- if (!entry) {
- entry = GuildModel.build({
- id: this.guild.id,
- prefix: value
- });
- } else {
- entry.prefix = value;
- }
- await entry.save();
- }
-}
-
-export class BotGuild extends Guild {
- constructor(client: BotClient, data: Record<string, unknown>) {
- super(client, data);
- }
- static install(): void {
- Structures.extend('Guild', () => BotGuild);
- }
- public settings = new GuildSettings(this);
- public client: BotClient;
-}
diff --git a/src/lib/extensions/BotMessage.ts b/src/lib/extensions/BotMessage.ts
deleted file mode 100644
index 70d4478..0000000
--- a/src/lib/extensions/BotMessage.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import {
- TextChannel,
- NewsChannel,
- DMChannel,
- Message,
- Structures
-} from 'discord.js';
-import { BotClient } from './BotClient';
-import { Guild as GuildModel } from '../models';
-import { BotGuild } from './BotGuild';
-
-export class GuildSettings {
- private message: BotMessage;
- constructor(message: BotMessage) {
- this.message = message;
- }
- public async getPrefix(): Promise<string> {
- return await GuildModel.findByPk(this.message.guild.id).then(
- (gm) => gm?.prefix || this.message.client.config.prefix
- );
- }
- public async setPrefix(value: string): Promise<void> {
- let entry = await GuildModel.findByPk(this.message.guild.id);
- if (!entry) {
- entry = GuildModel.build({
- id: this.message.guild.id,
- prefix: value
- });
- } else {
- entry.prefix = value;
- }
- await entry.save();
- }
-}
-
-export class BotMessage extends Message {
- constructor(
- client: BotClient,
- data: Record<string, unknown>,
- channel: TextChannel | DMChannel | NewsChannel
- ) {
- super(client, data, channel);
- }
- public guild: BotGuild;
- public client: BotClient;
- static install(): void {
- Structures.extend('Message', () => BotMessage);
- }
- public settings = new GuildSettings(this);
-}