Discord API
By creating a Discord object and calling login() on it, the game server can establish a connection to Discord and exchange information in both way. Purposes can be logging player activities or provided slack commands. See Discord Examples for examples.
- new Discord(botname: string) - object, creates and resturns an object used to communicate with Discord; botname must be a configured bot which has access to your Discord server.
- Discord.get(botname: string) - object, returns a previously created Discord client
- this.on(event: string, (params) => { ... }) - installs event handlers, events can be "ready", "messageCreate" and more; the parameters to the callback depend on the event
- this.login() - connects to the Discord server
- this.destroy() - disconnects from Discord
- this.sendtochannel(channelid: string, message: string or object) - sends a message or object to a specific Discord channel; get the channel id by right-click on the channel name; the message can be text, a URL or an object with attributes content and/or embeds.