Merge branch 'dev' of gitlab.libraryofcode.org:engineering/communityrelations into dev
commit
5134249625
|
@ -42,5 +42,6 @@
|
||||||
"import/extensions": "off",
|
"import/extensions": "off",
|
||||||
"no-param-reassign": "off",
|
"no-param-reassign": "off",
|
||||||
"no-underscore-dangle": "off"
|
"no-underscore-dangle": "off"
|
||||||
}
|
},
|
||||||
|
"ignorePatterns": "**/*.js"
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,14 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"eris": "bsian03/eris#bsian",
|
"eris": "^0.13.3",
|
||||||
"eris-pagination": "bsian03/eris-pagination",
|
"eris-pagination": "bsian03/eris-pagination",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"helmet": "^3.22.0",
|
"helmet": "^3.22.0",
|
||||||
"moment": "^2.25.3",
|
"moment": "^2.25.3",
|
||||||
"mongoose": "^5.9.13",
|
"mongoose": "^5.9.13",
|
||||||
"nodemailer": "^6.4.8",
|
"nodemailer": "^6.4.8",
|
||||||
|
"pluris": "^0.2.5",
|
||||||
"signale": "^1.4.0",
|
"signale": "^1.4.0",
|
||||||
"uuid": "^8.0.0",
|
"uuid": "^8.0.0",
|
||||||
"yaml": "^1.9.2"
|
"yaml": "^1.9.2"
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import eris from 'eris';
|
import eris from 'eris';
|
||||||
|
import pluris from 'pluris';
|
||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { Collection, Command, LocalStorage, Util, ServerManagement, Event } from '.';
|
import { Collection, Command, LocalStorage, Util, ServerManagement, Event } from '.';
|
||||||
import { File, FileInterface, Member, MemberInterface, Moderation, ModerationInterface, Note, NoteInterface, PagerNumber, PagerNumberInterface, Rank, RankInterface, Redirect, RedirectInterface, Stat, StatInterface } from '../models';
|
import { File, FileInterface, Member, MemberInterface, Moderation, ModerationInterface, Note, NoteInterface, PagerNumber, PagerNumberInterface, Rank, RankInterface, Redirect, RedirectInterface, Stat, StatInterface } from '../models';
|
||||||
import { Config } from '../../types'; // eslint-disable-line
|
import { Config } from '../../types'; // eslint-disable-line
|
||||||
|
|
||||||
|
pluris(eris);
|
||||||
|
|
||||||
export default class Client extends eris.Client {
|
export default class Client extends eris.Client {
|
||||||
public config: Config;
|
public config: Config;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { Message, EmbedOptions } from 'eris';
|
||||||
|
import axios, { AxiosResponse, AxiosError } from 'axios';
|
||||||
|
import { Client, Command, RichEmbed } from '../class';
|
||||||
|
|
||||||
|
export default class Eris extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'eris';
|
||||||
|
this.description = 'Get information about Eris.';
|
||||||
|
this.usage = 'eris <query>';
|
||||||
|
this.permissions = 0;
|
||||||
|
this.guildOnly = false;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(message: Message, args: string[]) {
|
||||||
|
try {
|
||||||
|
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||||
|
|
||||||
|
let res: AxiosResponse<{embed: EmbedOptions}>;
|
||||||
|
try {
|
||||||
|
res = await axios.get('https://erisdocs.cloud.libraryofcode.org/docs', { params: { search: args[0] } });
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code === 404) return this.error(message.channel, 'Could not find information. Try something else.');
|
||||||
|
return this.error(message.channel, 'Please try again later, something unexpected happened.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return message.channel.createMessage(res.data);
|
||||||
|
} catch (err) {
|
||||||
|
return this.client.util.handleError(err, message, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ export { default as delnote } from './delnote';
|
||||||
export { default as delrank } from './delrank';
|
export { default as delrank } from './delrank';
|
||||||
export { default as delredirect } from './delredirect';
|
export { default as delredirect } from './delredirect';
|
||||||
export { default as djs } from './djs';
|
export { default as djs } from './djs';
|
||||||
|
export { default as eris } from './eris';
|
||||||
export { default as eval } from './eval';
|
export { default as eval } from './eval';
|
||||||
export { default as game } from './game';
|
export { default as game } from './game';
|
||||||
export { default as help } from './help';
|
export { default as help } from './help';
|
||||||
|
|
|
@ -36,6 +36,7 @@ export default class NPM extends Command {
|
||||||
let dependencies: string = 'None';
|
let dependencies: string = 'None';
|
||||||
if (version !== 'Unknown' && data.versions[version].dependencies !== undefined && Object.keys(data.versions[version].dependencies).length > 0) {
|
if (version !== 'Unknown' && data.versions[version].dependencies !== undefined && Object.keys(data.versions[version].dependencies).length > 0) {
|
||||||
dependencies = Object.keys(data.versions[version].dependencies).join(', ');
|
dependencies = Object.keys(data.versions[version].dependencies).join(', ');
|
||||||
|
if (dependencies.length > 1024) dependencies = `${dependencies.substr(0, 1021)}...`;
|
||||||
}
|
}
|
||||||
const name: string = data.name || 'None';
|
const name: string = data.name || 'None';
|
||||||
const repository: string = bugs.replace('/issues', '') || '';
|
const repository: string = bugs.replace('/issues', '') || '';
|
||||||
|
|
46
src/main.ts
46
src/main.ts
|
@ -1,23 +1,23 @@
|
||||||
/* DM Ramirez with the code below to claim 500 free Rubies!
|
/* DM Ramirez with the code below to claim 500 free Rubies!
|
||||||
d2c3d8e14b
|
d2c3d8e14b
|
||||||
*/
|
*/
|
||||||
import { parse } from 'yaml';
|
import { parse } from 'yaml';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import { Client } from './class';
|
import { Client } from './class';
|
||||||
import * as eventFiles from './events';
|
import * as eventFiles from './events';
|
||||||
import * as commandFiles from './commands';
|
import * as commandFiles from './commands';
|
||||||
import { Config } from '../types'; // eslint-disable-line
|
import { Config } from '../types'; // eslint-disable-line
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
const read = await fs.readFile('../config.yaml', 'utf8');
|
const read = await fs.readFile('../config.yaml', 'utf8');
|
||||||
const config: Config = parse(read);
|
const config: Config = parse(read);
|
||||||
const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true });
|
const client = new Client(config.token, { defaultImageFormat: 'png', restMode: true });
|
||||||
client.config = config;
|
client.config = config;
|
||||||
await client.loadDatabase();
|
await client.loadDatabase();
|
||||||
client.loadPlugins();
|
client.loadPlugins();
|
||||||
await client.loadEvents(eventFiles);
|
await client.loadEvents(eventFiles);
|
||||||
await client.loadCommands(commandFiles);
|
await client.loadCommands(commandFiles);
|
||||||
client.connect();
|
client.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -603,9 +603,10 @@ eris-reactions@^0.1.2:
|
||||||
resolved "https://registry.yarnpkg.com/eris-reactions/-/eris-reactions-0.1.2.tgz#2d4edbf5f80dc964f0bb42fd301d3d8a141a5aa1"
|
resolved "https://registry.yarnpkg.com/eris-reactions/-/eris-reactions-0.1.2.tgz#2d4edbf5f80dc964f0bb42fd301d3d8a141a5aa1"
|
||||||
integrity sha512-p497xAdNsw3RRfAoklYemWRk1HT22rBmRaiemG6TVZ1yPTuQf41r4GteyKOJZ3hkphD3Rte7/1GiZwPzUNOHcw==
|
integrity sha512-p497xAdNsw3RRfAoklYemWRk1HT22rBmRaiemG6TVZ1yPTuQf41r4GteyKOJZ3hkphD3Rte7/1GiZwPzUNOHcw==
|
||||||
|
|
||||||
eris@bsian03/eris#bsian:
|
eris@^0.13.3:
|
||||||
version "0.13.1"
|
version "0.13.3"
|
||||||
resolved "https://codeload.github.com/bsian03/eris/tar.gz/b363a59225db374eca1547adba201310cb3489f4"
|
resolved "https://registry.yarnpkg.com/eris/-/eris-0.13.3.tgz#22abb71f9ce0d453200b537cad457dc39c7b302b"
|
||||||
|
integrity sha512-WBtLyknOWZpYZL9yPhez0oKUWvYpunSg43hGxawwjwSf3gFXmbEPYrT8KlmZXtpJnX16eQ7mzIq+MgSh3LarEg==
|
||||||
dependencies:
|
dependencies:
|
||||||
ws "^7.2.1"
|
ws "^7.2.1"
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
|
@ -1668,6 +1669,15 @@ pkg-dir@^2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
find-up "^2.1.0"
|
find-up "^2.1.0"
|
||||||
|
|
||||||
|
pluris@^0.2.5:
|
||||||
|
version "0.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/pluris/-/pluris-0.2.5.tgz#e98d8e0e7a49432b8bfe168b46e919e55405259e"
|
||||||
|
integrity sha512-K7UsbUn7uKflcnLRwN9g4sSlFsGYtM+sYhrO+nFrNTay/Gn6wTnhZlMbiIg1dXIy6+gnpVQZqVGghmBJb9t1Pg==
|
||||||
|
dependencies:
|
||||||
|
eris "^0.13.3"
|
||||||
|
optionalDependencies:
|
||||||
|
eris-reactions "^0.1.2"
|
||||||
|
|
||||||
prelude-ls@^1.2.1:
|
prelude-ls@^1.2.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
||||||
|
|
Loading…
Reference in New Issue