Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 2.16 KB

API.md

File metadata and controls

56 lines (40 loc) · 2.16 KB

API documentation

Authentication

Authenticating with the Discord can be done in one of three ways:

  • Using a Webhook URL gained by creating a Webhook bot.
  • Using a bot token gained by registering a bot
  • Using a user email and password credentials (notice that you should not use a user account to connect bots)

Webhook

Webhooks are a low-effort way to post messages to channels in Discord. They do not require a bot user or authentication to use. They cannot read messages from a channel.

A typical example is being informed about GitHub repository changes. This case does not require extra resources, is supported directly by Discord.

Bot

Other option is creating a bot. Such account, Discord calls it apps, can be used for chatbots that can read and write messages and manage associated serves and channels.

To create a bot, check following steps:

Remember that the new Bot has to connect to Gateway at least once, before sending messages. Gateways are Discord's form of real-time communication over secure WebSockets. Clients receive events and data over the gateway they are connected to and send data over the REST API.

User Client

The third option to connect to Discord within Pharo is by using a user account, email and password. Notice that using such account to connect bots is strictly prohibited. You should not use your user account to automate login and other operations!

Examples

Examples are divided into three sections:

  • Webhook
  • Bot
  • User Client Note: this documentation is missing. You can find examples on DSClient class side.

For more examples, please, check the class sides of the corresponding classes. We use GT-Examples to document the source code.