a lot of random stuff
commit
126c3253b2
|
@ -1,4 +1,10 @@
|
||||||
{
|
{
|
||||||
"eslint.enable": true,
|
"eslint.enable": true,
|
||||||
"eslint.validate": [ { "language": "typescript", "autoFix": true } ]
|
"eslint.validate": [
|
||||||
|
{
|
||||||
|
"language": "typescript",
|
||||||
|
"autoFix": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"editor.tabSize": 2
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ import mongoose from 'mongoose';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { config, Util } from '.';
|
import { config, Util } from '.';
|
||||||
import { Account, AccountInterface, Moderation, ModerationInterface } from './models';
|
import { Account, AccountInterface, Moderation, ModerationInterface, Domain, DomainInterface } from './models';
|
||||||
import { emojis } from './stores';
|
import { emojis } from './stores';
|
||||||
import { Command } from './class';
|
import { Command } from './class';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export default class Client extends Eris.Client {
|
||||||
|
|
||||||
public aliases: Map<string, string>;
|
public aliases: Map<string, string>;
|
||||||
|
|
||||||
public db: { Account: mongoose.Model<AccountInterface>; Moderation: mongoose.Model<ModerationInterface>; };
|
public db: { Account: mongoose.Model<AccountInterface>; Domain: mongoose.Model<DomainInterface>; Moderation: mongoose.Model<ModerationInterface>; };
|
||||||
|
|
||||||
public stores: { emojis: { success: string, loading: string, error: string }; };
|
public stores: { emojis: { success: string, loading: string, error: string }; };
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export default class Client extends Eris.Client {
|
||||||
this.util = new Util(this);
|
this.util = new Util(this);
|
||||||
this.commands = new Map();
|
this.commands = new Map();
|
||||||
this.aliases = new Map();
|
this.aliases = new Map();
|
||||||
this.db = { Account, Moderation };
|
this.db = { Account, Domain, Moderation };
|
||||||
this.stores = { emojis };
|
this.stores = { emojis };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { default as Command } from './Command';
|
||||||
|
export { default as RichEmbed } from './RichEmbed';
|
|
@ -1 +1,37 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
|
import { Client, Util, config } from '..';
|
||||||
|
import { Command, RichEmbed } from '../class';
|
||||||
|
|
||||||
|
export default class Help extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'help';
|
||||||
|
this.description = 'Display a list of commands';
|
||||||
|
this.usage = `${config.prefix}help | ${config.prefix}help ping`;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
util: Util = new Util(this.client);
|
||||||
|
|
||||||
|
public async run(message: Message, args?: string[]) {
|
||||||
|
const cmd = args.filter((c) => c)[0];
|
||||||
|
if (!cmd) {
|
||||||
|
const cmdList: Command[] = [];
|
||||||
|
this.client.commands.forEach((c) => cmdList.push(c));
|
||||||
|
const commands = cmdList.map((c) => {
|
||||||
|
const aliases = c.aliases.map((alias) => `${config.prefix}${alias}`).join(', ');
|
||||||
|
const perms: string[] = [];
|
||||||
|
let allowedRoles = c.permissions && c.permissions.roles && c.permissions.roles.map((r) => `<@&${r}>`).join(', ');
|
||||||
|
if (allowedRoles) { allowedRoles = `**Roles:** ${allowedRoles}`; perms.push(allowedRoles); }
|
||||||
|
let allowedUsers = c.permissions && c.permissions.users && c.permissions.users.map((u) => `<@${u}>`).join(', ');
|
||||||
|
if (allowedUsers) { allowedUsers = `**Users:** ${allowedUsers}`; perms.push(allowedUsers); }
|
||||||
|
const displayedPerms = perms.length ? `**Permissions:**\n${perms.join('\n')}` : '';
|
||||||
|
return { name: `${config.prefix}${c.name}`, value: `**Description:** ${c.description}\n**Aliases:** ${aliases}\n**Usage:** ${c.usage}\n${displayedPerms}`, inline: true };
|
||||||
|
});
|
||||||
|
|
||||||
|
const embed = new RichEmbed();
|
||||||
|
embed.setTimestamp(); embed.setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, message.author.avatarURL);
|
||||||
|
embed.setAuthor(`${this.client.user.username}#${this.client.user.discriminator}`, this.client.user.avatarURL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export { default as Lock } from './lock';
|
||||||
|
export { default as Modlogs } from './modlogs';
|
||||||
|
export { default as Ping } from './ping';
|
|
@ -1,11 +1,9 @@
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
import { Client, Util } from '..';
|
import { Client } from '..';
|
||||||
import { Command } from '../class';
|
import { Command } from '../class';
|
||||||
|
|
||||||
export default class Lock extends Command {
|
export default class Lock extends Command {
|
||||||
util: Util = new Util(this.client)
|
|
||||||
|
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'lock';
|
this.name = 'lock';
|
||||||
|
@ -20,7 +18,7 @@ export default class Lock extends Command {
|
||||||
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
|
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
|
||||||
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);
|
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return this.util.handleError(error, message, this);
|
return this.client.util.handleError(error, message, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
import { createPaginationEmbed } from 'eris-pagination';
|
import { createPaginationEmbed } from 'eris-pagination';
|
||||||
import { Client, Util } from '..';
|
import { Client, Util } from '..';
|
||||||
import { Command, RichEmbed } from '../class';
|
import { Command, RichEmbed } from '../class';
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
import { Client, Util } from '..';
|
import { Client } from '..';
|
||||||
import { Command } from '../class';
|
import { Command } from '../class';
|
||||||
|
|
||||||
export default class Ping extends Command {
|
export default class Ping extends Command {
|
||||||
util: Util = new Util(this.client)
|
|
||||||
|
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'ping';
|
this.name = 'ping';
|
||||||
|
@ -18,7 +16,7 @@ export default class Ping extends Command {
|
||||||
const msg: Message = await message.channel.createMessage('🏓 Pong!');
|
const msg: Message = await message.channel.createMessage('🏓 Pong!');
|
||||||
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
|
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.util.handleError(error, message, this);
|
this.client.util.handleError(error, message, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export { default as messageCreate } from './messageCreate';
|
|
@ -0,0 +1,8 @@
|
||||||
|
export { default as Client } from './Client';
|
||||||
|
export { default as config } from './config.json';
|
||||||
|
export { default as Util } from './Util';
|
||||||
|
export { default as Classes } from './class';
|
||||||
|
export { default as Commands } from './commands';
|
||||||
|
export { default as Events } from './events';
|
||||||
|
export { default as Models } from './models';
|
||||||
|
export { default as Stores } from './stores';
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { Document, Schema, model } from 'mongoose';
|
||||||
|
import { AccountInterface } from './Account';
|
||||||
|
|
||||||
|
export interface DomainInterface extends Document {
|
||||||
|
account: AccountInterface,
|
||||||
|
domain: string,
|
||||||
|
port: number,
|
||||||
|
// Below is the full absolute path to the location of the x509 certificate and key files.
|
||||||
|
x509: {
|
||||||
|
cert: string,
|
||||||
|
key: string
|
||||||
|
},
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
|
||||||
|
const Domain: Schema = new Schema({
|
||||||
|
account: Object,
|
||||||
|
domain: String,
|
||||||
|
port: Number,
|
||||||
|
x509: { cert: String, key: String },
|
||||||
|
enabled: Boolean,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default model<DomainInterface>('Domain', Domain);
|
|
@ -0,0 +1,3 @@
|
||||||
|
export { default as Account, AccountInterface } from './Account';
|
||||||
|
export { default as Moderation, ModerationInterface } from './Moderation';
|
||||||
|
export { default as Domain, DomainInterface } from './Domain';
|
|
@ -0,0 +1 @@
|
||||||
|
export { default as emojis } from './emojis';
|
Loading…
Reference in New Issue