discord_gleam
gleam add discord_gleam
import discord_gleam
import discord_gleam/event_handler
import discord_gleam/types/message
import discord_gleam/discord/intents
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", intents.Intents(message_content: True, guild_messages: True))
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:
Feature | Status |
---|---|
Basic events | โ |
More events | ๐จ |
Sending messages | โ |
Ban/kick | โ |
Deleting messages | โ |
Embeds | โ |
Basic Slash commands | โ |
Cache | ๐จ |
Intents | ๐ |
โ - Done | ๐จ - In Progress | ๐ - Planned | โ - Not Planned
Supported events:
- READY
- MESSAGE_CREATE
- MESSAGE_DELETE
- INTERACTION_CREATE