Chew / JDA-Chewtils

Chew's fork of JDA-Applications/JDA-Utilities, with support for modern features such as Slash Commands, Context Menus, and more.

Home Page:https://chew.pro/JDA-Chewtils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context Menus not being found

Matyrobbrt opened this issue · comments

Issue Checklist

  • I have checked for similar issues on the Issue tracker
  • I have updated to the latest version of JDA-Chewtils.
  • I have checked the branches or the maintainer's PRs for upcoming bug fixes.

Affected Modules

Command

Description

Context menus can contain uppercase characters in their name, and when they are registered (using CommandClient#addContextMenu) in contextMenuIndex from CommandClientImpl the index is associated with the menu name, exactly as it is in the field (uppercased). However CommandClientImpl#onMessageContextMenu tries to get the index associated with the command name, lowercased, and such the command cannot be found if it contains uppercase characters.

Possible ways of fixing

  • Get rid of the toLowercase call when the command is searched. This fix is preferred, as there could be 2 menus with the same name, but different cases
  • Make addContextMenu lowercase the command name when inserting it in the map.

I'm not sure how Discord handles case sensitivity. If it allows "rory" and "Rory" as valid names then we should do the former. Should probably get rid of the checks altogether since you could have a message and user context menu with the same name and be fine.

From my testing, it seems to allow 2 different commands with different letter casings

Indeed, this also caused issues when a User and Message context menu had the same name.