Timeout command
I am trying to get my timeout command to work but I keep getting > ERROR [22:21:32] Error while executing timeout command: Cannot read properties of undefined (reading 'getUser')
and when I get that away it does show everything properly but the command does not get the user timeout I am not sure if its the Rest API or something else any help with me very much helpful
6 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
Thanks!
Let me test a fer things
This looks to be syntax of @discordjs/core based on the usage of the
api
parameter. Note that if you're using /core, you aren't getting the same level of abstraction as mainlib discord.js, which leads me to say that there is no options
field shipped with interaction payloads, resulting in the error you're getting. If you would like to get the resolved data from interaction payloads, you need to either parse/index for it yourself, or use a package like @sapphire/discord-utilities
with its InteractionOptionResolver
utility class which parses resolved data from interaction payloads where you can then use getX()
methods to get said data.
Note that @discordjs/core
includes a version of discord-api-types
which has a PermissionFlagsBits
object with bigint values for each permissions as well as a MessageFlags
enum so you can get more readable code than using raw values like 64
, so you don't need to be storing the values yourself like I see you doing at the top of that file. Also note that the API
class with /core includes subclasses so you don't need to use Axios to make requests like you're doing to time out a member. You can instead use <GuildsAPI>.editMember(guildId, userId, { communication_disabled_until: timeoutUntil })
:property: API#guilds
@1.2.0
:method: GuildsAPI#editMember() @1.2.0
Edits a guild member
:dtypes: v10: PermissionFlagsBits
read more
:dtypes: v10: MessageFlags - Ephemeral
read morenpm
@sapphire/discord-utilities
Discord specific utilities for your JavaScript/TypeScript bots. Latest version: 3.3.0, last published: 3 months ago. Start using @sapphire/discord-utilities in your project by running
npm i @sapphire/discord-utilities
. There are 7 other projects in the npm registry using @sapphire/discord-utilities.