From f2a7407784856ed050a17ef4745aa773f083343e Mon Sep 17 00:00:00 2001 From: John Schiltz Date: Tue, 30 Aug 2022 23:29:25 -0500 Subject: [PATCH] switch to using class CODE as key rather than suuid This only works wile the codes are unique --- commands/owner/csClassPoll.ts | 2 +- package-lock.json | 45 ----------------------------------- package.json | 3 +-- rolesOps.ts | 2 +- 4 files changed, 3 insertions(+), 49 deletions(-) diff --git a/commands/owner/csClassPoll.ts b/commands/owner/csClassPoll.ts index 84170c7..ce970e6 100644 --- a/commands/owner/csClassPoll.ts +++ b/commands/owner/csClassPoll.ts @@ -103,7 +103,7 @@ function split_list(list: Array, max_list_len: number) { function create_option_from_class(_class: Class): MessageSelectOptionData { return { label: _class.CODE, - value: _class.UUID, + value: _class.CODE, description: _class.TITLE, } } diff --git a/package-lock.json b/package-lock.json index a70909a..20d3f34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "discord.js": "^13.9.2", "mongoose": "^6.2.2", "path": "^0.12.7", - "short-uuid": "^4.2.0", "ts-node": "^10.5.0", "typescript": "^4.5.5", "wokcommands": "^1.5.3" @@ -210,11 +209,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -672,18 +666,6 @@ "node": ">=6" } }, - "node_modules/short-uuid": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz", - "integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==", - "dependencies": { - "any-base": "^1.1.0", - "uuid": "^8.3.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/sift": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", @@ -814,14 +796,6 @@ "inherits": "2.0.3" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -1038,11 +1012,6 @@ "color-convert": "^2.0.1" } }, - "any-base": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", - "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" - }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1359,15 +1328,6 @@ "sparse-bitfield": "^3.0.3" } }, - "short-uuid": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz", - "integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==", - "requires": { - "any-base": "^1.1.0", - "uuid": "^8.3.2" - } - }, "sift": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.0.tgz", @@ -1455,11 +1415,6 @@ "inherits": "2.0.3" } }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index f96f811..7954d10 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,8 @@ "discord.js": "^13.9.2", "mongoose": "^6.2.2", "path": "^0.12.7", - "short-uuid": "^4.2.0", "ts-node": "^10.5.0", "typescript": "^4.5.5", "wokcommands": "^1.5.3" } -} \ No newline at end of file +} diff --git a/rolesOps.ts b/rolesOps.ts index ed570ce..67c0fc1 100644 --- a/rolesOps.ts +++ b/rolesOps.ts @@ -48,7 +48,7 @@ export async function addNewRole(member: GuildMember, type: string, id: string) // This function is triggered when a user changes their role, it adds the new role to the user let role; if (type === "class") { - role = await classModel.findOne({ UUID: id }); + role = await classModel.findOne({ CODE: id }); } else if (type === "staff") { role = await staffModel.findOne({ ROLE_NAME: id }); } else if (type === "year") {