Meridian
DIAdiscord.js - Imagine an app
•Created by Meridian on 10/11/2024 in #djs-questions
Type error with ApplicationCommandType and ContextMenuCommandType
I just upgraded TypeScript and some other things in my package.json and it apparently now thinks that the following code is invalid:
When checking the types
ContextMenuCommandBuilder#setType()
requires the type ContextMenuCommandType
, which is resolved to ApplicationCommandType.Message | ApplicationCommandType.User
.
So why are these types not compatible to each other? Is this possibly due to a version mismatch?
My versions:
Thanks in advance.14 replies
DIAdiscord.js - Imagine an app
•Created by Meridian on 3/7/2023 in #djs-questions
Is there any disadvantage when registering global commands on bot startup?
I'm trying to create a bot that is simple to setup and run yourself, which would also require it to register its own commands itself.
Are there any issues if I register the commands before logging the bot in, which would essentially overwrite the global commands every time you restart it?
As far as I can tell, overwriting commands does not count towards the daily creation limit.
Or should I get the currently registered commands and manually check them for differences before trying to overwrite them?
I know that the common practice is to use a
deploy-commands.js
script, but I'd like to automate deploying.5 replies
DIAdiscord.js - Imagine an app
•Created by Meridian on 9/21/2022 in #djs-questions
DiscordAPIError - Invalid code in request
i'm getting this error sometimes when trying to exchange a token on
/oauth2/token
after logging in with oauth:
the weird thing: its working most of the time, which is also why i cant really reproduce it.
my callback looks like this:
which means the request shouldnt even be made when there is no code.
/callback
is also the direct redirect_uri, which means the request there should only have valid codes directly from discord
any ideas here?5 replies
DIAdiscord.js - Imagine an app
•Created by Meridian on 8/14/2022 in #djs-questions
voiceStateUpdate returns same channel IDs when disconnecting a user via right-click.
How can I detect if the bot has been disconnected by a user with
client.on('voiceStateUpdate', (oldState, newState) => {})
?
I'm first comparing if the voiceStateUpdate even is about the bot using if (newState.guild.me.id === newState.member.id)
and then trying to detect a disconnect using if (!newState.channelId)
but it's not working.
Any ideas?
v13.8.013 replies