From 03d90949dfe82d64aeb58bf7affae0690de85555 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 16 Jun 2022 18:29:15 +0200 Subject: [PATCH] storing list of auto assignable roles on the server --- backend/src/api/controllers/result.ts | 7 ++++- backend/src/constants/auto-roles.ts | 38 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 backend/src/constants/auto-roles.ts diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index c6b99ac15..b6fc4bf4d 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -27,6 +27,7 @@ import { } from "../../utils/prometheus"; import * as George from "../../tasks/george"; import { getDailyLeaderboard } from "../../utils/daily-leaderboards"; +import AutoRoleList from "../../constants/auto-roles"; try { if (anticheatImplemented() === false) throw new Error("undefined"); @@ -292,7 +293,11 @@ export async function addResult( } } - if (result.challenge && user.discordId) { + if ( + result.challenge && + AutoRoleList.includes(result.challenge) && + user.discordId + ) { George.awardChallenge(user.discordId, result.challenge); } else { delete result.challenge; diff --git a/backend/src/constants/auto-roles.ts b/backend/src/constants/auto-roles.ts new file mode 100644 index 000000000..dd80dc29a --- /dev/null +++ b/backend/src/constants/auto-roles.ts @@ -0,0 +1,38 @@ +export default [ + "oneHourWarrior", + "doubleDown", + "tripleTrouble", + "quad", + "trueSimp", + "bigramSalad", + "simp", + "antidiseWhat", + "whatsThisWebsiteCalledAgain", + "developd", + "slowAndSteady", + "speedSpacer", + "iveGotThePower", + "accuracyExpert", + "accuracyMaster", + "accuracyGod", + "jolly", + "gottaCatchEmAll", + "rapGod", + "navySeal", + "rollercoaster", + "oneHourMirror", + "chooChoo", + "earfquake", + "simonSez", + "accountant", + "hidden", + "iCanSeeTheFuture", + "whatAreWordsAtThisPoint", + "specials", + "aeiou", + "asciiWarrior", + "iKiNdAlIkEhOwInEfFiCiEnTqWeRtYiS", + "oneNauseousMonkey", + "69", + "englishMaster", +];