owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!
https://owencalvin.github.io/discord.ts/
325 stars 40 forks source link

can't inject Client on @On("ready") #38

Closed singatias closed 3 years ago

singatias commented 3 years ago

the client is undefined when injected in the ready event. I'm trying to create a channel if it doesn't exist when my bot startup.

SteeledSlagle13 commented 3 years ago

can u post a snippet of your code

SteeledSlagle13 commented 3 years ago
@Once("ready")
onReady([]: ArgsOf<"ready">, client: Client): void {
  //client stuff
}

is how you can do that with the client injection https://github.com/OwenCalvin/discord.ts#client-payload-injection

singatias commented 3 years ago

Sorry for the late response. I was missing the []: ArgsOf<"ready"> first part.

Thank You

SteeledSlagle13 commented 3 years ago

np :D