odin-bot-v2
odin-bot-v2 copied to clipboard
Feat: Add is admin utility
Because
- We currently duplicate this code
This PR
- Adds an
isAdmin(member)
utility -
Adds a new package:
@discordjs/collection
. This is necessary because previously we mocked role caches as beingMap
s, whereas they are actuallyCollection
s. There are some key differences between the two, of which the most relevant is that Collections have a.some()
method, which Maps don't have - Replace all code that did this previously with usages of the new function
- Fixes using
Map()
for mocking inpoints.test.js
to useCollection()
instead - Runs prettier over all affected files
Issue
Closes #566
Pull Request Requirements
- [x] I have thoroughly read and understand The Odin Project Contributing Guide
- [] The title of this PR follows thelocation of change: brief description of change
format, e.g.Callbacks command: Update verbiage
- [x] The
Because
section summarizes the reason for this PR - [x] The
This PR
section has a bullet point list describing the changes in this PR - [x] If this PR addresses an open issue, it is linked in the
Issue
section - [x] If this PR adds new features or functionality, I have added new tests
- [x] If applicable, I have ensured all tests related to any command files included in this PR pass, and/or all snapshots are up to date