[BUG] Repeated role creation #4

Closed
opened 2023-06-22 05:58:27 +00:00 by lucxjo · 0 comments
Owner

ER has a feature that allows boosters to update their perk roles themselves in development.

Expected Behavior

When boosting a guild, a role should be created if not exists

Current Behaviour

Will create as many roles as the api will allow before crashing

Possible Solution

Check decorator, if it’s @On() then switch to @Once(). Check guild to see if a role exists with that name beforehand

Logs

/app/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:152
			throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData);
    at handleErrors (/app/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:152:10)
DiscordAPIError[30005]: Maximum number of server roles reached (250)
         ^
    at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:399:20)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:169:11)
    at async RoleManager.create (/app/node_modules/discord.js/src/managers/RoleManager.js:147:18)
    at async REST.request (/app/node_modules/@discordjs/rest/src/lib/REST.ts:343:20)
    at async next (file:///app/node_modules/discordx/src/decorators/classes/Method.ts:88:15)
    at async MemberEvent.memberUpdate (file:///app/src/events/member_event.ts:35:22)
    at async file:///app/node_modules/discordx/src/logic/metadata/MetadataStorage.ts:609:23
  requestBody: {
    at async Promise.all (index 0) {
    files: undefined,
    json: {
      name: '#',
      color: undefined,
      unicode_emoji: undefined
      mentionable: undefined,
      hoist: undefined,
      permissions: undefined,
      icon: undefined,
    }
    code: 30005
    message: 'Maximum number of server roles reached (250)',
  rawError: {
  },
  code: 30005,
  url: 'https://discord.com/api/v10/guilds/862756950654713877/roles'
  status: 400,
  method: 'POST',
}
ER has a feature that allows boosters to update their perk roles themselves in development. ## Expected Behavior When boosting a guild, a role should be created if not exists ## Current Behaviour Will create as many roles as the api will allow before crashing ## Possible Solution Check decorator, if it’s @On() then switch to @Once(). Check guild to see if a role exists with that name beforehand ## Logs ``` /app/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:152 throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData); at handleErrors (/app/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:152:10) DiscordAPIError[30005]: Maximum number of server roles reached (250) ^ at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:399:20) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:169:11) at async RoleManager.create (/app/node_modules/discord.js/src/managers/RoleManager.js:147:18) at async REST.request (/app/node_modules/@discordjs/rest/src/lib/REST.ts:343:20) at async next (file:///app/node_modules/discordx/src/decorators/classes/Method.ts:88:15) at async MemberEvent.memberUpdate (file:///app/src/events/member_event.ts:35:22) at async file:///app/node_modules/discordx/src/logic/metadata/MetadataStorage.ts:609:23 requestBody: { at async Promise.all (index 0) { files: undefined, json: { name: '#', color: undefined, unicode_emoji: undefined mentionable: undefined, hoist: undefined, permissions: undefined, icon: undefined, } code: 30005 message: 'Maximum number of server roles reached (250)', rawError: { }, code: 30005, url: 'https://discord.com/api/v10/guilds/862756950654713877/roles' status: 400, method: 'POST', } ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lucxjo/er#4
No description provided.