discord-tickets / bot

The most popular open-source and self-hosted ticket management bot for Discord - a free alternative to the premium and white-label plans of other popular ticketing bots.
https://discordtickets.app
GNU General Public License v3.0
880 stars 459 forks source link

[BUG] User->Create context menu command fails because the button's custom ID is too long #494

Open eartharoid opened 9 months ago

eartharoid commented 9 months ago

Is there an existing issue for this?

Current Behavior

User->Create worked in testing, but the creation prompt button can't be sent if the action and/or categoryId push the custom ID over the 100-character limit.

 16/10/23 23:53:51  [ERROR] (MENUS) "create" menu execution error: ExpectedConstraintError > s.string.lengthLessThanOrEqual
  Invalid string length

  Expected: expected.length <= 100

  Received:
  | '{"action":"questions","categoryId":1686,"referencesMessage":"1126972889170718753/1163549810507386973"}'

    at Object.run (/home/container/node_modules/.pnpm/@sapphire+shapeshift@3.9.2/node_modules/@sapphire/shapeshift/dist/index.js:1546:79)
    at /home/container/node_modules/.pnpm/@sapphire+shapeshift@3.9.2/node_modules/@sapphire/shapeshift/dist/index.js:212:66
    at Array.reduce (<anonymous>)
    at StringValidator.parse (/home/container/node_modules/.pnpm/@sapphire+shapeshift@3.9.2/node_modules/@sapphire/shapeshift/dist/index.js:212:29)
    at ModalBuilder.setCustomId (/home/container/node_modules/.pnpm/@discordjs+builders@1.6.3/node_modules/@discordjs/builders/dist/index.js:1342:45)
    at TicketManager.create (/home/container/src/lib/tickets/manager.js:276:7)
    at async CreateMenu.run (/home/container/src/menus/create.js:18:3)

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS:
- Node:
- NPM:
- Bot: 4.0.10

Anything else?

The channel ID in referencesMessage probably isn't necessary as the button should always be in the same channel as the message.