Common Usage Cases
#
Core Setup GuideWe are going to learn how to start using library and combine it with currently used code.
We are going to use discord.js package.
#
SetupHere is the very simple discord bot setup we're going to use.
- TypeScript
- JavaScript
#
Creating ClientNow that we have a basic setup we can create our GatewayClient to start interacting with dclist
- TypeScript
- JavaScript
#
Voter-Only CommandsYou may have some voter-only features. You can do that easily using official sdk.
There is as veeery simple example for using #isUserVoted method of GatewayClient.
- TypeScript
- JavaScript
#
Subscribe to EventsDclist using a bit different system to handle real time events. Instead of creating an express just for new vote event, directly connecting to server using websockets.
That means you don't have to set up any other settings to use events.
Here is a veeery simple vote logger code just to give an idea.
#
Demanding EventsFirst you need to tell server about which events you want to receive. Then server will start sending events in real time to you.
- TypeScript
- JavaScript
#
Handling EventsWhen a real time event received, GatewayClient will emit an event named same as received event's type.
- TypeScript
- JavaScript
#
AutoPoster UsageYou need to send some report to the site so we can display your bot's guild, user, etc. count and track your growth rate for you.
You can achive that with few lines of change. There is an example for sharded and standalone bots.
#
Stand-Alone Bot Setup- TypeScript
- JavaScript
#
Multi-Sharded Bot Setup#
Shard Manager File- TypeScript
- JavaScript
#
Shard Client File- TypeScript
- JavaScript