How to reference client in main file?
I am trying to get
<Client>.users
from the index.ts but I am unsure as to how I would get around to doing that..Solution:Jump to solution
if youre using sapphire, you can do
this.container.client
or import the container from the framework and then container.client
5 Replies
Just try it!
You must have created a client, now put a dot (.) & Find out
There's docs too
Solution
if youre using sapphire, you can do
this.container.client
or import the container from the framework and then container.client
which you can find hereee https://www.sapphirejs.dev/docs/Guide/additional-information/using-and-extending-container#using-container
Sapphire Framework
Using and extending container | Sapphire
The container is a way in which Sapphire achieves Dependency Injection. This is a very useful feature, since it
Make sure the client has logged in first, or you won't be able to access any users. Consider doing whatever you're doing in the ready event?
thanks