muse: DiscordAPIError: 405: Method Not Allowed | Crashes While Bot is Invited to Any Server
What’s happening? Crashes immediately after inviting to a server. Tested changing permission integer to 8 (Administrator) out of curiosity but no change. Have invited it to two servers. One I am the owner of, the other I just have manage server permissions. Only invited the bot to the server I own as Administrator. Each subsequent attempt to run the bot while it is in any guild will crash until the bot is kicked from all servers. Appears to crash while processing permissions.
Logs
✔ Database migrations applied.
✔ Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=<censored>&scope=bot%20applications.commands&permissions=36700288
/root/muse/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: 405: Method Not Allowed
at RequestHandler.execute (/root/muse/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/root/muse/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async ApplicationCommandPermissionsManager.set (/root/muse/node_modules/discord.js/src/managers/ApplicationCommandPermissionsManager.js:186:18)
at async updatePermissionsForGuild (file:///root/muse/src/utils/update-permissions-for-guild.ts:32:3)
at async Client.guild_create_default (file:///root/muse/src/events/guild-create.ts:36:3) {
method: 'put',
path: '/applications/968996889099911238/guilds/450306155361861632/commands/permissions',
code: 0,
httpStatus: 405,
requestData: {
json: [
{
id: '968999097581322281',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322282',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322283',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322284',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322285',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322286',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322287',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322288',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322289',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097581322290',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637696',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637697',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637698',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637699',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637700',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637701',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637702',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
},
{
id: '968999097652637703',
permissions: [
{ id: '148334523514486784', permission: true, type: 2 },
{ id: '450306155361861632', permission: false, type: 1 },
{ id: '148334523514486784', permission: true, type: 2 }
]
}
],
files: []
}
}
file:///root/muse/node_modules/execa/lib/error.js:59
error = new Error(message);
^
Error: Command failed with exit code 1: esmo src/scripts/migrate-and-start.ts
at makeError (file:///root/muse/node_modules/execa/lib/error.js:59:11)
at handlePromise (file:///root/muse/node_modules/execa/index.js:119:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async file:///root/muse/src/scripts/run-with-database-url.ts:5:3 {
shortMessage: 'Command failed with exit code 1: esmo src/scripts/migrate-and-start.ts',
command: 'esmo src/scripts/migrate-and-start.ts',
escapedCommand: 'esmo "src/scripts/migrate-and-start.ts"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Screenshots N/A
Additional context
Fresh install of v1.9.0 branch.
Installed using command npm i.
Run using command npm run start.
Runtime I’m running Muse:
- Directly from the cloned repository
- Inside a Docker container
- Something else (please elaborate)
Versions
- Muse: 1.9.0
- Docker (if applicable): N/A
- OS: Ubuntu Server 16.04 LTS
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 35 (15 by maintainers)
Issue due to breaking change in discord API from April 27th: https://discord.com/developers/docs/change-log
Disabled the batch editing endpoint ([PUT /applications/{application.id}/guilds/{guild.id}/commands/permissions](https://discord.com/developers/docs/interactions/application-commands#batch-edit-application-command-permissions)).I’ll try to take a look at this tomorrow.
PRs welcome if someone figures out a fix. 😃
Looks like Discord updated some stuff yesterday, it also mentions changes to batch editing of permissions here: https://discord.com/developers/docs/change-log
Tried going back to older versions of the bot and got the same error.
Check the ‘Running’ section of the Readme here.
You can find the parameters in the OAuth2 Menu:
Hi @h45h74x I opend up a PR, maybe you also can take a look into branch https://github.com/kkendzia/muse/tree/fix/command_permission. With adding oauth2 capabilities the bot is able to set permissions. Feel free to add comments!