Merge branch 'dev'

merge-requests/9/merge
Matthew 2020-04-20 13:58:42 -04:00
commit beff369177
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
9 changed files with 43 additions and 70 deletions

View File

@ -26,10 +26,13 @@ export default class Command {
/** /**
* - **0:** Everyone * - **0:** Everyone
* - **1:** Associates Team+ * - **1:** Associates+
* - **2:** Sheriff+ * - **2:** Core Team+
* - **3:** Faculty Marshals+ * - **3:** Moderators, Supervisor, Board of Directors
* - **4:** Marshal Generals of Engineering * - **4:** Technicians, Supervisor, Board of Directors
* - **5:** Moderators, Technicians, Supervisor, Board of Directors
* - **6:** Supervisor+
* - **7:** Board of Directors
*/ */
public permissions: number; public permissions: number;
@ -57,13 +60,17 @@ export default class Command {
case 0: case 0:
return true; return true;
case 1: case 1:
return member.roles.some((r) => ['662163685439045632', '455972169449734144', '453689940140883988'].includes(r)); return member.roles.some((r) => ['701481967149121627', '453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
case 2: case 2:
return member.roles.some((r) => ['662163685439045632', '455972169449734144'].includes(r)); return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
case 3: case 3:
return member.roles.some((r) => ['662163685439045632'].includes(r)); return member.roles.some((r) => ['455972169449734144', '701454855952138300', '662163685439045632'].includes(r));
case 4: case 4:
return member.id === '278620217221971968' || member.id === '253600545972027394'; return member.roles.some((r) => ['701454780828221450', '701454855952138300', '662163685439045632'].includes(r));
case 5:
return member.roles.some((r) => ['701454855952138300', '662163685439045632'].includes(r));
case 6:
return member.roles.includes('662163685439045632');
default: default:
return false; return false;
} }

View File

@ -1,6 +1,6 @@
/* eslint-disable no-bitwise */ /* eslint-disable no-bitwise */
import { Member, User } from 'eris'; import { Member, User } from 'eris';
import { v4 as uuid } from 'uuid'; import { randomBytes } from 'crypto';
import moment, { unitOfTime } from 'moment'; import moment, { unitOfTime } from 'moment';
import { Client, RichEmbed } from '.'; import { Client, RichEmbed } from '.';
import { Moderation as ModerationModel, ModerationInterface } from '../models'; import { Moderation as ModerationModel, ModerationInterface } from '../models';
@ -43,7 +43,7 @@ export default class Moderation {
public async ban(user: User, moderator: Member, duration: number, reason?: string): Promise<ModerationInterface> { public async ban(user: User, moderator: Member, duration: number, reason?: string): Promise<ModerationInterface> {
if (reason && reason.length > 512) throw new Error('Ban reason cannot be longer than 512 characters'); if (reason && reason.length > 512) throw new Error('Ban reason cannot be longer than 512 characters');
await this.client.guilds.get(this.client.config.guildID).banMember(user.id, 7, reason); await this.client.guilds.get(this.client.config.guildID).banMember(user.id, 7, reason);
const logID = uuid(); const logID = randomBytes(2).toString('hex');
const mod = new ModerationModel({ const mod = new ModerationModel({
userID: user.id, userID: user.id,
logID, logID,
@ -85,7 +85,7 @@ export default class Moderation {
this.client.unbanGuildMember(this.client.config.guildID, userID, reason); this.client.unbanGuildMember(this.client.config.guildID, userID, reason);
const user = await this.client.getRESTUser(userID); const user = await this.client.getRESTUser(userID);
if (!user) throw new Error('Cannot get user.'); if (!user) throw new Error('Cannot get user.');
const logID = uuid(); const logID = randomBytes(2).toString('hex');
const mod = new ModerationModel({ const mod = new ModerationModel({
userID, userID,
logID, logID,

View File

@ -8,7 +8,7 @@ export default class Ban extends Command {
this.name = 'ban'; this.name = 'ban';
this.description = 'Bans a member from the guild.'; this.description = 'Bans a member from the guild.';
this.usage = 'ban <member> [time] [reason]'; this.usage = 'ban <member> [time] [reason]';
this.permissions = 2; this.permissions = 3;
this.guildOnly = true; this.guildOnly = true;
this.enabled = true; this.enabled = true;
} }

View File

@ -9,7 +9,7 @@ export default class Eval extends Command {
this.name = 'eval'; this.name = 'eval';
this.description = 'Evaluates native JS code'; this.description = 'Evaluates native JS code';
this.aliases = ['e']; this.aliases = ['e'];
this.permissions = 4; this.permissions = 7;
this.enabled = true; this.enabled = true;
this.guildOnly = false; this.guildOnly = false;
} }

View File

@ -3,11 +3,11 @@ import { Activity, Member, Message } from 'eris';
import { Client, Command, RichEmbed } from '../class'; import { Client, Command, RichEmbed } from '../class';
enum ActivityType { enum ActivityType {
PLAYING = 0, PLAYING,
STREAMING = 1, STREAMING,
LISTENING = 2, LISTENING,
WATCHING = 3, WATCHING,
CUSTOM_STATUS = 4 CUSTOM_STATUS
} }
export default class Game extends Command { export default class Game extends Command {

View File

@ -7,7 +7,7 @@ export default class Unban extends Command {
this.name = 'unban'; this.name = 'unban';
this.description = 'Unbans a member from the guild.'; this.description = 'Unbans a member from the guild.';
this.usage = 'unban <user id> [reason]'; this.usage = 'unban <user id> [reason]';
this.permissions = 2; this.permissions = 3;
this.guildOnly = true; this.guildOnly = true;
this.enabled = true; this.enabled = true;
} }

View File

@ -42,8 +42,8 @@ export default class Whois extends Command {
const ackResolve = this.resolveStaffInformation(member.id); const ackResolve = this.resolveStaffInformation(member.id);
let description = ''; let description = '';
if (ackResolve) { if (ackResolve) {
if (ackResolve?.title && ackResolve?.dept) { if (ackResolve?.title) {
description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`; description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__\n\n`;
} }
if (ackResolve?.emailAddress) { if (ackResolve?.emailAddress) {
description += `${emotes.email} ${ackResolve.emailAddress}\n`; description += `${emotes.email} ${ackResolve.emailAddress}\n`;

View File

@ -2,8 +2,7 @@
{ {
"name": "Matthew", "name": "Matthew",
"id": "278620217221971968", "id": "278620217221971968",
"title": "Marshal General of Engineering", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "matthew@staff.libraryofcode.org", "emailAddress": "matthew@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/matthew", "gitlab": "https://gitlab.libraryofcode.org/matthew",
"github": "https://github.com/matthew119427", "github": "https://github.com/matthew119427",
@ -13,8 +12,7 @@
{ {
"name": "Joe", "name": "Joe",
"id": "556969659531001858", "id": "556969659531001858",
"title": "Marshal General of Community Relations", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "joe@staff.libraryofcode.org", "emailAddress": "joe@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/Joe", "gitlab": "https://gitlab.libraryofcode.org/Joe",
"github": "https://github.com/sirdroolio", "github": "https://github.com/sirdroolio",
@ -24,8 +22,7 @@
{ {
"name": "Bsian", "name": "Bsian",
"id": "253600545972027394", "id": "253600545972027394",
"title": "Assistant Marshal General of Engineering", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "bsian@staff.libraryofcode.org", "emailAddress": "bsian@staff.libraryofcode.org",
"bio": "I also like trains", "bio": "I also like trains",
"acknowledgements": ["Maintainer & Assistant Lead Developer"] "acknowledgements": ["Maintainer & Assistant Lead Developer"]
@ -33,23 +30,20 @@
{ {
"name": "NightRaven", "name": "NightRaven",
"id": "239261547959025665", "id": "239261547959025665",
"title": "Assistant Marshal General of Community Relations", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "nightraven@staff.libraryofcode.org", "emailAddress": "nightraven@staff.libraryofcode.org",
"bio": "I like trains" "bio": "I like trains"
}, },
{ {
"name": "Midori", "name": "Midori",
"id": "109122112643440640", "id": "109122112643440640",
"title": "Assistant Marshal General of Community Relations", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "midori@staff.libraryofcode.org" "emailAddress": "midori@staff.libraryofcode.org"
}, },
{ {
"name": "Unknown", "name": "Unknown",
"id": "143414786913206272", "id": "143414786913206272",
"title": "Staff Sergeant", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "unknown@staff.libraryofcode.org", "emailAddress": "unknown@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/unknown", "gitlab": "https://gitlab.libraryofcode.org/unknown",
"bio": "im not a proffesional developer or anything, i just enjoy it as a hobby." "bio": "im not a proffesional developer or anything, i just enjoy it as a hobby."
@ -57,53 +51,26 @@
{ {
"name": "TheSkele27", "name": "TheSkele27",
"id": "213632190557192192", "id": "213632190557192192",
"title": "Community Advisor", "title": "Board of Directors",
"dept": "Faculty Marshals",
"emailAddress": "theskele27@staff.libraryofcode.org", "emailAddress": "theskele27@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/TheSkele27", "gitlab": "https://gitlab.libraryofcode.org/TheSkele27",
"github": "https://github.com/TheSkele27", "github": "https://github.com/TheSkele27",
"bio": "Is water wet?" "bio": "Is water wet?"
}, },
{
"name": "Aikaterna",
"id": "154497072148643840",
"title": "Sheriff",
"dept": "Staff Team"
},
{
"name": "Boss",
"id": "344954369285947392",
"title": "Sheriff",
"dept": "Staff Team",
"emailAddress": "boss@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/Boss",
"bio": "I cant find a bio for user \"boss\""
},
{ {
"name": "Besero", "name": "Besero",
"id": "283318906024886272", "id": "283318906024886272",
"title": "Associate", "title": "Associate",
"dept": "Staff Team",
"emailAddress": "besero@staff.libraryofcode.org", "emailAddress": "besero@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/besero_gg", "gitlab": "https://gitlab.libraryofcode.org/besero_gg",
"github": "https://github.com/kledi-harding", "github": "https://github.com/kledi-harding",
"bio": "Just looking for some fun. I like going on long walks in the park. No guys", "bio": "Just looking for some fun. I like going on long walks in the park. No guys",
"acknowledgements": ["Graphic Designer"] "acknowledgements": ["Graphic Designer"]
}, },
{
"name": "CoalSephos",
"id": "155698776512790528",
"title": "Associate",
"dept": "Staff Team",
"gitlab": "https://gitlab.libraryofcode.org/CoalSephos",
"github": "https://github.com/CoalSephos",
"bio": "[Tastes like chicken?]"
},
{ {
"name": "D3XTER", "name": "D3XTER",
"id": "468009964263178262", "id": "468009964263178262",
"title": "Associate", "title": "Core Team",
"dept": "Staff Team",
"emailAddress": "dexter@staff.libraryofcode.org", "emailAddress": "dexter@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/D3XTER", "gitlab": "https://gitlab.libraryofcode.org/D3XTER",
"bio": "Hi I'm D3XTER how are ya?" "bio": "Hi I'm D3XTER how are ya?"
@ -111,8 +78,7 @@
{ {
"name": "DedShotTM", "name": "DedShotTM",
"id": "402154763363418142", "id": "402154763363418142",
"title": "Associate", "title": "Technician & Moderator",
"dept": "Staff Team",
"emailAddress": "dedshot@staff.libraryofcode.org", "emailAddress": "dedshot@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/DedShotTM", "gitlab": "https://gitlab.libraryofcode.org/DedShotTM",
"github": "https://github.com/DedShotTM", "github": "https://github.com/DedShotTM",
@ -122,8 +88,7 @@
{ {
"name": "EdgyBoi2414", "name": "EdgyBoi2414",
"id": "397432516010835970", "id": "397432516010835970",
"title": "Webmaster", "title": "Core Team",
"dept": "Staff Team",
"emailAddress": "edgyboi2414@gmail.com", "emailAddress": "edgyboi2414@gmail.com",
"gitlab": "https://gitlab.libraryofcode.org/EdgyBoi2414", "gitlab": "https://gitlab.libraryofcode.org/EdgyBoi2414",
"github": "https://github.com/EdgyBoi2414", "github": "https://github.com/EdgyBoi2414",
@ -132,8 +97,7 @@
{ {
"name": "Hector", "name": "Hector",
"id": "377781496292835339", "id": "377781496292835339",
"title": "Associate", "title": "Core Team",
"dept": "Staff Team",
"emailAddress": "hector@staff.libraryofcode.org", "emailAddress": "hector@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/Hector", "gitlab": "https://gitlab.libraryofcode.org/Hector",
"github": "https://github.com/Hector6704", "github": "https://github.com/Hector6704",
@ -142,8 +106,7 @@
{ {
"name": "KhaaZ", "name": "KhaaZ",
"id": "179908288337412096", "id": "179908288337412096",
"title": "Associate", "title": "Core Team",
"dept": "Staff Team",
"gitlab": "https://gitlab.libraryofcode.org/KhaaZ", "gitlab": "https://gitlab.libraryofcode.org/KhaaZ",
"github": "https://github.com/Khaazz", "github": "https://github.com/Khaazz",
"bio": "I baguette for a living and eat code for breakfast." "bio": "I baguette for a living and eat code for breakfast."

View File

@ -1,3 +1,6 @@
/* DM Ramirez with the code below to claim 500 free Rubies!
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';