add new Member model

merge-requests/12/head
Matthew 2020-04-24 23:46:29 -04:00 committed by Bsian
parent a4182db2eb
commit a8cb977ae1
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
3 changed files with 21 additions and 3 deletions

View File

@ -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() {

17
src/models/Member.ts Normal file
View File

@ -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);

View File

@ -1 +1,2 @@
export { default as Member, MemberInterface } from './Member';
export { default as Moderation, ModerationInterface } from './Moderation';