add new Member model
parent
cd6a10480b
commit
9ddc800e2a
|
@ -2,7 +2,7 @@ import eris from 'eris';
|
|||
import mongoose from 'mongoose';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Collection, Command, Util } from '.';
|
||||
import { Moderation, ModerationInterface } from '../models';
|
||||
import { Member, MemberInterface, Moderation, ModerationInterface } from '../models';
|
||||
|
||||
export default class Client extends eris.Client {
|
||||
public config: { token: string, prefix: string, guildID: string, mongoDB: string };
|
||||
|
@ -13,14 +13,14 @@ export default class Client extends eris.Client {
|
|||
|
||||
public util: Util;
|
||||
|
||||
public db: { moderation: mongoose.Model<ModerationInterface> };
|
||||
public db: { member: mongoose.Model<MemberInterface>, moderation: mongoose.Model<ModerationInterface> };
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor(token: string, options?: eris.ClientOptions) {
|
||||
super(token, options);
|
||||
this.commands = new Collection<Command>();
|
||||
this.intervals = new Collection<NodeJS.Timeout>();
|
||||
this.db = { moderation: Moderation };
|
||||
this.db = { member: Member, moderation: Moderation };
|
||||
}
|
||||
|
||||
public async loadDatabase() {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { Document, Schema, model } from 'mongoose';
|
||||
|
||||
export interface MemberInterface extends Document {
|
||||
userID: string
|
||||
additional: {
|
||||
langs: ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'],
|
||||
},
|
||||
}
|
||||
|
||||
const Member: Schema = new Schema({
|
||||
userID: String,
|
||||
additional: {
|
||||
langs: Array,
|
||||
},
|
||||
});
|
||||
|
||||
export default model<MemberInterface>('Member', Member);
|
|
@ -1 +1,2 @@
|
|||
export { default as Member, MemberInterface } from './Member';
|
||||
export { default as Moderation, ModerationInterface } from './Moderation';
|
||||
|
|
Loading…
Reference in New Issue