Comments (5)
Yes. @On
injects the client object as the last parameter of the function which is why you have to include it. Take a quick look at the Readme
from discord.ts.
Isn't onReady
in your case a member of the class you decorated with @Discord
.
Your own class does not inherit Client. If you want access to the properties of the discord client object, you need to use it this way:
@On('ready')
async onReady(client: Client){
console.log(client.user);
// Do stuff with user
}
from discord.ts.
Okay, so I have the same issue and for some reason @On('ready')
gets called twice.
from discord.ts.
Isn't
onReady
in your case a member of the class you decorated with@Discord
.
Your own class does not inherit Client. If you want access to the properties of the discord client object, you need to use it this way:@On('ready') async onReady(client: Client){ console.log(client.user); // Do stuff with user }
The function is inside a class decorated with @Discord, do i still need to pass in the parameter for Client ?
from discord.ts.
Yes you have to use the client parameter on the event function :)
Thank's @Fredi100 for the support!
from discord.ts.
Related Issues (20)
- [FEATURE] Option to mention bot HOT 1
- guildMemberAdd and guildMemberRemove events seem to not work somehow HOT 1
- [Feature Request] Globally apply a guard HOT 2
- [Question/bug] The @CommandNotFound decorator seems to not function for me HOT 8
- can't inject Client on @On("ready") HOT 4
- Add support for slash commands HOT 4
- Info and Description decorators not working on commands HOT 1
- Event guildMemberAdd and guildMemberRemove not working
- cannot use dynamic prefix with Mysql HOT 2
- Can't find a way to post an embeded message HOT 2
- Multiple bots support HOT 1
- The slash command does not execute correctly HOT 2
- Can't use @Permission on class
- Support ButtonInteraction
- Can't use @Option as a required option
- Guards TypeError: undefined is not a function HOT 14
- "messageReactionAdd" listener is not triggered in old messages HOT 2
- Support for Context Menu (User and Message) Interactions HOT 1
- Template not avaiable HOT 2
- getInteractionGroupTree TypeError HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.ts.