glyph/clients/bot

This contains the client with functions specifically made for Bot users.

Types

Type that contains necessary information when communicating with the Discord API

pub type BotClient {
  BotClient(
    token_type: rest.TokenType,
    token: String,
    client_url: String,
    client_version: String,
    intents: Int,
    handlers: discord.EventHandler,
    api_client: api.APIClient,
  )
}

Constructors

  • BotClient(
      token_type: rest.TokenType,
      token: String,
      client_url: String,
      client_version: String,
      intents: Int,
      handlers: discord.EventHandler,
      api_client: api.APIClient,
    )

Functions

pub fn initialize(b: BotClient) -> a

Initialize a client to begin communication with the gateway

pub fn new(
  token: String,
  client_url: String,
  client_version: String,
) -> BotClient

Construct a new BotClient

pub fn on_message_create(
  b: BotClient,
  callback: fn(Message) -> Result(Nil, DiscordError),
) -> BotClient

Register a handler for the MESSAGE_CREATE gateway event

pub fn send(
  b: BotClient,
  channel_id: String,
  message: String,
) -> Result(Nil, APIError)

Send a message to a channel

pub fn set_intents(
  b: BotClient,
  intents: List(GatewayIntent),
) -> BotClient

Register intents for your bot

Search Document