discord_gleam

Package Version Hex Docs

gleam add discord_gleam
import discord_gleam
import discord_gleam/event_handler
import discord_gleam/types/message
import gleam/list
import gleam/string
import logging

pub fn main() {
  logging.configure()
  logging.set_level(logging.Info)

  let bot = discord_gleam.bot("YOUR TOKEN")

  discord_gleam.run(bot, [event_handler])
}

fn event_handler(bot, packet: event_handler.Packet) {
  case packet {
    event_handler.MessagePacket(message) -> {
      logging.log(logging.Info, "Message: " <> message.d.content)
      case message.d.content {
        "!ping" -> {
          discord_gleam.send_message(bot, message.d.channel_id, "Pong!", [])
        }
        _ -> Nil
      }
    }
    _ -> Nil
  }
}

Further documentation can be found at https://hexdocs.pm/discord_gleam.

Development

gleam test  # Run the tests

Features:

FeatureStatus
Basic eventsโœ…
More events๐Ÿ”จ
Sending messagesโœ…
Ban/kickโœ…
Deleting messagesโœ…
Embedsโœ…
Basic Slash commandsโœ…

โœ… - Done | ๐Ÿ”จ - In Progress | ๐Ÿ“† - Planned | โŒ - Not Planned

Supported events:

โœจ Search Document