odin-bot-v2 icon indicating copy to clipboard operation
odin-bot-v2 copied to clipboard

Feat: Add is admin utility

Open Asartea opened this issue 7 months ago • 0 comments

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 being Maps, whereas they are actually Collections. 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 in points.test.js to use Collection() 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 the location 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

Asartea avatar Jul 14 '24 16:07 Asartea