resolve merge conf

pull/29/head
Matthew 2020-07-19 18:04:04 -04:00
commit cbb5a2373a
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
5 changed files with 24 additions and 6 deletions

View File

@ -3,9 +3,10 @@ import mongoose from 'mongoose';
import { promises as fs } from 'fs';
import { Collection, Command, LocalStorage, Util, ServerManagement, Event } from '.';
import { File, FileInterface, Member, MemberInterface, Moderation, ModerationInterface, PagerNumber, PagerNumberInterface, Rank, RankInterface, Redirect, RedirectInterface } from '../models';
import { Config } from '../../types'; // eslint-disable-line
export default class Client extends eris.Client {
public config: { token: string, prefix: string, guildID: string, mongoDB: string, emailPass: string, };
public config: Config;
public commands: Collection<Command>;

View File

@ -1,7 +1,7 @@
/* eslint-disable no-bitwise */
import nodemailer from 'nodemailer';
import signale from 'signale';
import { Member, Message, Guild, PrivateChannel, GroupChannel, Role, AnyGuildChannel } from 'eris';
import { Member, Message, Guild, PrivateChannel, GroupChannel, Role, AnyGuildChannel, WebhookPayload } from 'eris';
import { Client, Command, Moderation, RichEmbed } from '.';
import { statusMessages as emotes } from '../configs/emotes.json';
@ -79,7 +79,7 @@ export default class Util {
public async handleError(error: Error, message?: Message, command?: Command, disable = true): Promise<void> {
try {
this.signale.error(error);
const info = { content: `\`\`\`js\n${error.stack || error}\n\`\`\``, embed: null };
const info: WebhookPayload = { content: `\`\`\`js\n${error.stack || error}\n\`\`\``, embeds: [] };
if (message) {
const embed = new RichEmbed();
embed.setColor('FF0000');
@ -93,9 +93,9 @@ export default class Util {
else guild = message.channel.guild.id;
embed.addField('Message link', `[Click here](https://discordapp.com/channels/${guild}/${message.channel.id}/${message.id})`, true);
embed.setTimestamp(new Date(message.timestamp));
info.embed = embed;
info.embeds.push(embed);
}
await this.client.createMessage('595788220764127272', info);
await this.client.executeWebhook(this.client.config.webhookID, this.client.config.webhookToken, info);
const msg = message ? message.content.slice(this.client.config.prefix.length).trim().split(/ +/g) : [];
if (command && disable) this.resolveCommand(msg).then((c) => { c.cmd.enabled = false; });
if (message) message.channel.createMessage(`***${this.emojis.ERROR} An unexpected error has occured - please contact a Staff member.${command && disable ? ' This command has been disabled.' : ''}***`);

View File

@ -124,6 +124,13 @@
"emailAddress": "nicolas@staff.libraryofcode.org",
"bio": "I write C++ to pay off my student loans"
},
{
"name": "Sterben",
"id": "241361691730903040",
"dept": "Associate",
"emailAddress": "sterben@staff.libraryofcode.org",
"bio": "im bored"
},
{
"name": "Null",
"id": "323673862971588609",

View File

@ -6,10 +6,11 @@ import { promises as fs } from 'fs';
import { Client } from './class';
import * as eventFiles from './events';
import * as commandFiles from './commands';
import { Config } from '../types'; // eslint-disable-line
async function main(): Promise<void> {
const read = await fs.readFile('../config.yaml', 'utf8');
const config: { token: string, prefix: string, guildID: string, mongoDB: string, emailPass: string } = parse(read);
const config: Config = parse(read);
const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true });
client.config = config;
await client.loadDatabase();

9
types/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
export declare interface Config {
token: string;
prefix: string;
guildID: string;
mongoDB: string;
emailPass: string;
webhookID: string;
webhookToken: string;
}