Gateway Client
What is GatewayClient#
GatewayClient is the class allows you to interact with dclist's graphql API
Constructor#
Constructor method of GatewayClient accepts an object as first parameter. Properties of accepted object :
| Property | Type | Is Optional | Description |
|---|---|---|---|
| token | string | False | Token obtained from website |
| client | * | True | Your library's client object |
| enablePoster | boolean | True | Default false. Set true if you want to post your bot's stats automatically |
- TypeScript
- JavaScript
Methods#
getBotById#
Fetches the bot with given id.
| Property | Type | Is Optional | Description |
|---|---|---|---|
| botId | string | False | Discord id of the bot |
| fieldSelector | FieldSelector | True | Custom FieldSelector for advanced usage |
| Returns | Promise Bot | Returns a promise which will resolve an Bot object |
Fetch bot normally#
Fetch bot with custom FieldSelector#
- TypeScript
- JavaScript
getUserById#
Fetches the user with given id.
| Property | Type | Is Optional | Description |
|---|---|---|---|
| userId | string | False | Discord id of the user |
| fieldSelector | FieldSelector | True | Custom FieldSelector for advanced usage |
| Returns | Promise User | Returns a promise which will resolve an User object |
Fetch user normally#
Fetch user with custom FieldSelector#
- TypeScript
- JavaScript
isUserVoted#
Checks if user voted to the bot in last 12 hours.
| Property | Type | Is Optional | Description |
|---|---|---|---|
| userId | string | False | Discord id of the user |
| Returns | Promise boolean | Returns a promise which will resolve a boolean |
getUserComment#
Gets the comment posted by user on your bot
| Property | Type | Is Optional | Description |
|---|---|---|---|
| userId | string | False | Discord id of the user |
| fieldSelector | FieldSelector | True | Custom FieldSelector for advanced usage |
| Returns | Promise Comment | Returns a promise which will resolve an Comment object |
Fetch user comment#
Fetch user comment with custom FieldSelector#
- TypeScript
- JavaScript
subscribeTo#
Subscribes to given topics. Read more about events in dedicated guide.
| Property | Type | Is Optional | Description |
|---|---|---|---|
| topics | string array | False | List of topics you want to subscribe |
| fieldSelector | FieldSelector object | True | Custom FieldSelectors for each topics to advanced usage |
| Returns | array string | List of subscribed topics |
Subscribe to new vote event#
- TypeScript
- JavaScript