General Information
Summary
The codebase currently contains some hardcode strings like "admin" and "mentors" and it would be better to have those in a central lookup table.
Impact to Users
None, this is a code-quality issue.
Additional Information
Some examples of the hardcoded strings in the codebase as came up in a recent review:
|
if (!interaction.member.roles.cache.some((r) => r.name === "admin")) { |
and
|
if (!interaction.member.roles.cache.some((r) => r.name === "mentors")) { |
There may be others.
It would be better to store these in a lookup table in some roles.js file like
export const ROLES = {
ADMIN: "admin",
MENTORS: "mentors"
}
and then in the individual files you'd
import { ROLES } from './roles.js`
and replace the instances in the code like
"admin" -> ROLES.ADMIN
"mentors" -> ROLES.MENTORS
It might not be exactly like the above, but similar.
General Information
Summary
The codebase currently contains some hardcode strings like
"admin"and"mentors"and it would be better to have those in a central lookup table.Impact to Users
None, this is a code-quality issue.
Additional Information
Some examples of the hardcoded strings in the codebase as came up in a recent review:
discord-shift-swap/slash/edit.js
Line 35 in 40483d5
and
discord-shift-swap/slash/trade.js
Line 20 in 40483d5
There may be others.
It would be better to store these in a lookup table in some
roles.jsfile likeand then in the individual files you'd
and replace the instances in the code like
It might not be exactly like the above, but similar.