Help with @discordjs/core - interactionCreate argument passing
Hello,
So decided to use
@discordjs/core
. However when I went through the docs and got to the point where the interactionCreate
event is being listend to like that
I got kinda confused on how to properly translate that to my structure..2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!This is my current event-Handler function to register events.
First of all I still need to figure out how to fix the error where I check if the event should be called once or not because of the spread operator..
A spread argument must either have a tuple type or be passed to a rest parameter.
I don't know how to fix it yet
The ready event works perfectly fine
But now I ask myself how do I get this to work for the interactionCreate event
This is my type for the event
For the type I think I fixed it . see edit
Uh
like this?
```ts
export interface Event {
type: keyof ManagerShardEventsMap;
once: boolean;
onEmit: (...args: any[]) => Promise<void>;
}```
Oh alright that's good to know
Well yep I guess I have to use WebSocketShardEvents.Ready then ?
Atleast this is what I have done now
```ts
async function doHandleReadyEvent(client: Client): Promise<void> {
client.api.users
.getCurrent()
.then(user => {
logger.info(
Bot successfully logged in! Username: ${user.username});
})
.catch(error => {
logger.error(
Error occured during login process! Error: ${error}`);
});
}
const readyEvent: Discord.Event<WebSocketShardEvents.Ready> = {
type: WebSocketShardEvents.Ready,
once: true,
onEmit: doHandleReadyEvent,
};
```
I do need to change the onEmit because of the params with client
Uhmm okay.. well the whole WebSocket thing is kinda new to me.. guess I gotta need way more time 😅
Or atleast saying the /core package
Well.. I went to the discordjs site and clicked on docs to see what is new since it's a bit since I wrote a bot.. so there I just saw that it said you need to npm i @discordjs/core
So I assumed this is new go to
But I guess not haha
Ohhh okay 😄 I really thought it's the new way 😅
Well I guess I am better of with using the mainlib for now