THREAD_CREATE event Listener run method arguments
What I want to do:
I want to inspect the id of the parent channel where the thread was created.
The code I tried:
The result I got:
stringify
on the thread can determine the parent_id
, but when accessed as an argument to the run
method, it returns undefined.
What am I missing?
Thanks,Solution
Favna•441d ago
Any event emitted by the discordjs websocket, such as THREAD_CREATE, doesn't receive a discordjs class, such as ThreadChannel, as first parameter. It receives the raw discord API data. If you type it as the type from discord-api-types (dunno which) you'll get the right properties in your code.
My guess is that it's an APIThreadChannel https://discord-api-types.dev/api/discord-api-types-v10/interface/APIThreadChannel
The
ws
event also receives only ONE argument which is that APIThreadChannel
, there is no second argument NewlyCreated
. That gets inserted by DiscordJS.
That said, you're far better off just rewriting it to the DiscordJS client event emitter:
discord-api-types documentation
discord-api-types - Imagine typings
discord-api-types is a simple Node/Deno module that brings up to date typings for Discord's API
RYU•440d ago
It was a huge help!
I verified the normal behavior with the code you wrote.
Thank you!
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsCommand info command issueI have a command info command, but when I try to get information on a command called "flags" it retuawait args.pick("member");how to enable this?
https://discord.com/channels/737141877803057244/737142071319855105/107804884825Command info command issueI have a command info command, but when I try to get information on a command called "flags" it retuRunning in productionHey! What's the recommended method for starting up a node app in production? Specifically for DiscorspeakerName translation in FFXIVIpcChatHello everyone,
I'm using ffxiv-pcap to read chat messages using the Sapphire Struct for chat messagClearing registered slash commandsHello 👋
I would like to know if there's a system provided by Sapphire to automatically clear previDocker being goofyI have no idea why Docker is being all goofy, it's saying that my discord token is invalid, but it'sReferenceError: [ENV] BOT_OWNER_IDS - The key must be an array, but is empty or undefined.I am using `@skyra/env-utilities` and when I start up my bot, I get the error reported in the title How can I turn a joinedTimestamp into this Discord TimestampThe one that automatically shows you like how long ago this timestamp wasHow to use `@sapphire/shapeshift ` dateValid & stringRegexI have a slash command that needs to take in a date input in the format of `YYYY-MM-DD`. I want to