push changes
parent
72da156f27
commit
90fd5394da
|
@ -1,2 +0,0 @@
|
||||||
yarnPath: ".yarn/releases/yarn-berry.cjs"
|
|
||||||
nodeLinker: node-modules
|
|
|
@ -2,9 +2,8 @@ import Stripe from 'stripe';
|
||||||
import eris from 'eris';
|
import eris from 'eris';
|
||||||
import pluris from 'pluris';
|
import pluris from 'pluris';
|
||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import Redis from 'ioredis';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { Collection, Command, LocalStorage, Queue, Util, ServerManagement, Event } from '.';
|
import { Collection, Command, InteractionCommand, LocalStorage, Queue, Util, ServerManagement, Event } from '.';
|
||||||
import {
|
import {
|
||||||
Customer, CustomerInterface,
|
Customer, CustomerInterface,
|
||||||
CustomerPortal, CustomerPortalInterface,
|
CustomerPortal, CustomerPortalInterface,
|
||||||
|
@ -31,15 +30,18 @@ import {
|
||||||
} from '../models';
|
} from '../models';
|
||||||
import { Config } from '../../types'; // eslint-disable-line
|
import { Config } from '../../types'; // eslint-disable-line
|
||||||
|
|
||||||
pluris(eris);
|
pluris(eris, { endpoints: false });
|
||||||
|
|
||||||
export default class Client extends eris.Client {
|
export default class Client extends eris.Client {
|
||||||
public config: Config;
|
public config: Config;
|
||||||
|
|
||||||
public commands: Collection<Command>;
|
public commands: Collection<Command>;
|
||||||
|
|
||||||
|
public interactions: Collection<InteractionCommand>;
|
||||||
|
|
||||||
public events: Collection<Event>;
|
public events: Collection<Event>;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
public intervals: Collection<NodeJS.Timeout>;
|
public intervals: Collection<NodeJS.Timeout>;
|
||||||
|
|
||||||
public util: Util;
|
public util: Util;
|
||||||
|
@ -81,7 +83,9 @@ export default class Client extends eris.Client {
|
||||||
constructor(token: string, options?: eris.ClientOptions) {
|
constructor(token: string, options?: eris.ClientOptions) {
|
||||||
super(token, options);
|
super(token, options);
|
||||||
this.commands = new Collection<Command>();
|
this.commands = new Collection<Command>();
|
||||||
|
this.interactions = new Collection<InteractionCommand>();
|
||||||
this.events = new Collection<Event>();
|
this.events = new Collection<Event>();
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
this.intervals = new Collection<NodeJS.Timeout>();
|
this.intervals = new Collection<NodeJS.Timeout>();
|
||||||
this.queue = new Queue(this);
|
this.queue = new Queue(this);
|
||||||
this.db = {
|
this.db = {
|
||||||
|
@ -121,10 +125,8 @@ export default class Client extends eris.Client {
|
||||||
|
|
||||||
|
|
||||||
public async loadDatabase() {
|
public async loadDatabase() {
|
||||||
await mongoose.connect(this.config.mongoDB, {
|
mongoose.connect(this.config.mongoDB, {
|
||||||
useNewUrlParser: true,
|
minPoolSize: 50,
|
||||||
useUnifiedTopology: true,
|
|
||||||
poolSize: 50,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const statMessages = await this.db.Stat.findOne({ name: 'messages' });
|
const statMessages = await this.db.Stat.findOne({ name: 'messages' });
|
||||||
|
@ -157,6 +159,7 @@ export default class Client extends eris.Client {
|
||||||
intervalFiles.forEach((file) => {
|
intervalFiles.forEach((file) => {
|
||||||
const intervalName = file.split('.')[0];
|
const intervalName = file.split('.')[0];
|
||||||
if (file === 'index.js') return;
|
if (file === 'index.js') return;
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const interval: NodeJS.Timeout = (require(`${__dirname}/../intervals/${file}`).default)(this);
|
const interval: NodeJS.Timeout = (require(`${__dirname}/../intervals/${file}`).default)(this);
|
||||||
this.intervals.add(intervalName, interval);
|
this.intervals.add(intervalName, interval);
|
||||||
this.util.signale.success(`Successfully loaded interval: ${intervalName}`);
|
this.util.signale.success(`Successfully loaded interval: ${intervalName}`);
|
||||||
|
@ -190,4 +193,15 @@ export default class Client extends eris.Client {
|
||||||
this.util.signale.success(`Successfully loaded command: ${command.name}`);
|
this.util.signale.success(`Successfully loaded command: ${command.name}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async loadInteractions(interactionFiles: { [s: string]: typeof InteractionCommand; } | ArrayLike<typeof InteractionCommand>) {
|
||||||
|
const intFiles = Object.values<typeof InteractionCommand>(interactionFiles);
|
||||||
|
for (const Int of intFiles) {
|
||||||
|
const interaction = new Int(this);
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
const c = await this.createGuildCommand(this.config.guildID, interaction.serializeData());
|
||||||
|
this.interactions.add(c.application_id, interaction);
|
||||||
|
this.util.signale.success(`Successfully loaded interaction: ${interaction.name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue