KevinNovak / Discord-Bot-TypeScript-Template

Discord bot - A discord.js bot template written with TypeScript.
MIT License
477 stars 86 forks source link

Register Commands No Longer Working Due to Permission Changes #44

Closed 0xzoz closed 2 years ago

0xzoz commented 2 years ago

Using yarn run commands:register returns a Discord API Error.

[2022-09-02 19:02:21.228] ERROR: An error occurred while running a command action.
    err: {
      "type": "DiscordAPIError",
      "message": "Bots cannot use this endpoint",
      "stack":
          DiscordAPIError[20001]: Bots cannot use this endpoint
              at SequentialHandler.runRequest (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:287:15)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at SequentialHandler.queueRequest (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:99:14)
              at REST.request (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/REST.ts:50:22)
              at CommandRegistrationService.process (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/src/services/command-registration-service.ts:24:27)
              at start (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/src/start-bot.ts:104:13)
      "rawError": {
        "message": "Bots cannot use this endpoint",
        "code": 20001
      },
      "code": 20001,
      "status": 403,
      "method": "GET",
      "url": "https://discord.com/api/v10/applications/tallyho--bot#8186/commands",
      "requestBody": {}
    }

This is due to changes in the Permissions V2 on (April 27, 2022). A related article can be found here

KevinNovak commented 2 years ago

Can you narrow down which command is causing the issue and post the metadata here?

Are you using default_permission in the metadata by chance? This was deprecated and replaced with default_member_permissions.

KevinNovak commented 2 years ago

Closing this. If you're still experiencing the issue please respond here / open a new issue.