From ba03174ce402e8bea47b79fc6def4c8a041f6e54 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 17 Apr 2020 20:31:15 -0400 Subject: [PATCH 1/5] enums dont have to explicity declare the #'s --- src/commands/game.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/game.ts b/src/commands/game.ts index 6404a7e..fded83d 100644 --- a/src/commands/game.ts +++ b/src/commands/game.ts @@ -3,11 +3,11 @@ import { Activity, Member, Message } from 'eris'; import { Client, Command, RichEmbed } from '../class'; enum ActivityType { - PLAYING = 0, - STREAMING = 1, - LISTENING = 2, - WATCHING = 3, - CUSTOM_STATUS = 4 + PLAYING, + STREAMING, + LISTENING, + WATCHING, + CUSTOM_STATUS } export default class Game extends Command { From 99d7e6c4330e1b065f755d062ca299e5e8bf6e3a Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 17 Apr 2020 20:31:24 -0400 Subject: [PATCH 2/5] easter egg --- src/main.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.ts b/src/main.ts index 6bb4a4b..5213da2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,6 @@ +/* DM Ramirez with the code below to claim 500 free Rubies! + d2c3d8e14b +*/ import { parse } from 'yaml'; import { promises as fs } from 'fs'; import { Client } from './class'; From d2d3a5c335806df150c636547044fe63bdd93efa Mon Sep 17 00:00:00 2001 From: Matthew R Date: Fri, 17 Apr 2020 23:05:10 -0400 Subject: [PATCH 3/5] remove uuid from log id, use randomBytes(2).toString('hex') instead --- src/class/Moderation.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/class/Moderation.ts b/src/class/Moderation.ts index 71fcb22..e7d3975 100644 --- a/src/class/Moderation.ts +++ b/src/class/Moderation.ts @@ -1,6 +1,6 @@ /* eslint-disable no-bitwise */ import { Member, User } from 'eris'; -import { v4 as uuid } from 'uuid'; +import { randomBytes } from 'crypto'; import moment, { unitOfTime } from 'moment'; import { Client, RichEmbed } from '.'; 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 { 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); - const logID = uuid(); + const logID = randomBytes(2).toString('hex'); const mod = new ModerationModel({ userID: user.id, logID, @@ -85,7 +85,7 @@ export default class Moderation { this.client.unbanGuildMember(this.client.config.guildID, userID, reason); const user = await this.client.getRESTUser(userID); if (!user) throw new Error('Cannot get user.'); - const logID = uuid(); + const logID = randomBytes(2).toString('hex'); const mod = new ModerationModel({ userID, logID, From 4541482cf5fcf16c9f2002c8cdfaf26a3d2fad5e Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 20 Apr 2020 13:56:54 -0400 Subject: [PATCH 4/5] acknowledgement title changes --- src/commands/whois.ts | 4 +- src/configs/acknowledgements.json | 61 ++++++------------------------- 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/src/commands/whois.ts b/src/commands/whois.ts index ff91bf9..ece051c 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -42,8 +42,8 @@ export default class Whois extends Command { const ackResolve = this.resolveStaffInformation(member.id); let description = ''; if (ackResolve) { - if (ackResolve?.title && ackResolve?.dept) { - description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__, ${ackResolve.dept}\n\n`; + if (ackResolve?.title) { + description += `${emotes.titleAndDepartment} __**${ackResolve.title}**__\n\n`; } if (ackResolve?.emailAddress) { description += `${emotes.email} ${ackResolve.emailAddress}\n`; diff --git a/src/configs/acknowledgements.json b/src/configs/acknowledgements.json index b47aa7c..463ecda 100644 --- a/src/configs/acknowledgements.json +++ b/src/configs/acknowledgements.json @@ -2,8 +2,7 @@ { "name": "Matthew", "id": "278620217221971968", - "title": "Marshal General of Engineering", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "matthew@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/matthew", "github": "https://github.com/matthew119427", @@ -13,8 +12,7 @@ { "name": "Joe", "id": "556969659531001858", - "title": "Marshal General of Community Relations", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "joe@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/Joe", "github": "https://github.com/sirdroolio", @@ -24,8 +22,7 @@ { "name": "Bsian", "id": "253600545972027394", - "title": "Assistant Marshal General of Engineering", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "bsian@staff.libraryofcode.org", "bio": "I also like trains", "acknowledgements": ["Maintainer & Assistant Lead Developer"] @@ -33,23 +30,20 @@ { "name": "NightRaven", "id": "239261547959025665", - "title": "Assistant Marshal General of Community Relations", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "nightraven@staff.libraryofcode.org", "bio": "I like trains" }, { "name": "Midori", "id": "109122112643440640", - "title": "Assistant Marshal General of Community Relations", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "midori@staff.libraryofcode.org" }, { "name": "Unknown", "id": "143414786913206272", - "title": "Staff Sergeant", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "unknown@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/unknown", "bio": "im not a proffesional developer or anything, i just enjoy it as a hobby." @@ -57,53 +51,26 @@ { "name": "TheSkele27", "id": "213632190557192192", - "title": "Community Advisor", - "dept": "Faculty Marshals", + "title": "Board of Directors", "emailAddress": "theskele27@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/TheSkele27", "github": "https://github.com/TheSkele27", "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 can’t find a bio for user \"boss\"" - }, { "name": "Besero", "id": "283318906024886272", "title": "Associate", - "dept": "Staff Team", "emailAddress": "besero@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/besero_gg", "github": "https://github.com/kledi-harding", "bio": "Just looking for some fun. I like going on long walks in the park. No guys", "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", "id": "468009964263178262", - "title": "Associate", - "dept": "Staff Team", + "title": "Core Team", "emailAddress": "dexter@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/D3XTER", "bio": "Hi I'm D3XTER how are ya?" @@ -111,8 +78,7 @@ { "name": "DedShotTM", "id": "402154763363418142", - "title": "Associate", - "dept": "Staff Team", + "title": "Technician & Moderator", "emailAddress": "dedshot@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/DedShotTM", "github": "https://github.com/DedShotTM", @@ -122,8 +88,7 @@ { "name": "EdgyBoi2414", "id": "397432516010835970", - "title": "Webmaster", - "dept": "Staff Team", + "title": "Core Team", "emailAddress": "edgyboi2414@gmail.com", "gitlab": "https://gitlab.libraryofcode.org/EdgyBoi2414", "github": "https://github.com/EdgyBoi2414", @@ -132,8 +97,7 @@ { "name": "Hector", "id": "377781496292835339", - "title": "Associate", - "dept": "Staff Team", + "title": "Core Team", "emailAddress": "hector@staff.libraryofcode.org", "gitlab": "https://gitlab.libraryofcode.org/Hector", "github": "https://github.com/Hector6704", @@ -142,8 +106,7 @@ { "name": "KhaaZ", "id": "179908288337412096", - "title": "Associate", - "dept": "Staff Team", + "title": "Core Team", "gitlab": "https://gitlab.libraryofcode.org/KhaaZ", "github": "https://github.com/Khaazz", "bio": "I baguette for a living and eat code for breakfast." From fee63d56aa4b3bc0f935ced6a4fca9c521185335 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Mon, 20 Apr 2020 13:57:08 -0400 Subject: [PATCH 5/5] perm changes --- src/class/Command.ts | 23 +++++++++++++++-------- src/commands/ban.ts | 2 +- src/commands/eval.ts | 2 +- src/commands/unban.ts | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/class/Command.ts b/src/class/Command.ts index 2fa7faa..7fc00f5 100644 --- a/src/class/Command.ts +++ b/src/class/Command.ts @@ -26,10 +26,13 @@ export default class Command { /** * - **0:** Everyone - * - **1:** Associates Team+ - * - **2:** Sheriff+ - * - **3:** Faculty Marshals+ - * - **4:** Marshal Generals of Engineering + * - **1:** Associates+ + * - **2:** Core Team+ + * - **3:** Moderators, Supervisor, Board of Directors + * - **4:** Technicians, Supervisor, Board of Directors + * - **5:** Moderators, Technicians, Supervisor, Board of Directors + * - **6:** Supervisor+ + * - **7:** Board of Directors */ public permissions: number; @@ -57,13 +60,17 @@ export default class Command { case 0: return true; 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: - return member.roles.some((r) => ['662163685439045632', '455972169449734144'].includes(r)); + return member.roles.some((r) => ['453689940140883988', '455972169449734144', '701454780828221450', '701454855952138300', '662163685439045632'].includes(r)); case 3: - return member.roles.some((r) => ['662163685439045632'].includes(r)); + return member.roles.some((r) => ['455972169449734144', '701454855952138300', '662163685439045632'].includes(r)); 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: return false; } diff --git a/src/commands/ban.ts b/src/commands/ban.ts index d8718c4..e8e43d5 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -8,7 +8,7 @@ export default class Ban extends Command { this.name = 'ban'; this.description = 'Bans a member from the guild.'; this.usage = 'ban [time] [reason]'; - this.permissions = 2; + this.permissions = 3; this.guildOnly = true; this.enabled = true; } diff --git a/src/commands/eval.ts b/src/commands/eval.ts index f62fc7a..e749d4d 100644 --- a/src/commands/eval.ts +++ b/src/commands/eval.ts @@ -9,7 +9,7 @@ export default class Eval extends Command { this.name = 'eval'; this.description = 'Evaluates native JS code'; this.aliases = ['e']; - this.permissions = 4; + this.permissions = 7; this.enabled = true; this.guildOnly = false; } diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 025758c..a0a4fbc 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -7,7 +7,7 @@ export default class Unban extends Command { this.name = 'unban'; this.description = 'Unbans a member from the guild.'; this.usage = 'unban [reason]'; - this.permissions = 2; + this.permissions = 3; this.guildOnly = true; this.enabled = true; }