Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyteon/discord_gleam
A library to create discord bots in gleam
https://github.com/cyteon/discord_gleam
discord discord-bot gleam gleam-lang
Last synced: 2 months ago
JSON representation
A library to create discord bots in gleam
- Host: GitHub
- URL: https://github.com/cyteon/discord_gleam
- Owner: Cyteon
- License: mit
- Created: 2024-07-15T11:20:37.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-08T15:41:44.000Z (4 months ago)
- Last Synced: 2024-10-01T20:40:03.947Z (4 months ago)
- Topics: discord, discord-bot, gleam, gleam-lang
- Language: Gleam
- Homepage:
- Size: 45.9 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# discord_gleam
[![Package Version](https://img.shields.io/hexpm/v/discord_gleam)](https://hex.pm/packages/discord_gleam)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/discord_gleam/)```sh
gleam add discord_gleam
``````gleam
import discord_gleam
import discord_gleam/event_handler
import discord_gleam/types/message
import gleam/list
import gleam/string
import loggingpub 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 .
## Development
```sh
gleam test # Run the tests
```## Features:
| Feature | Status |
| -------------------- | ------ |
| Basic events | ✅ |
| More events | 🔨 |
| Sending messages | ✅ |
| Ban/kick | ✅ |
| Deleting messages | ✅ |
| Embeds | ✅ |
| Basic Slash commands | ✅ |✅ - Done | 🔨 - In Progress | 📆 - Planned | ❌ - Not Planned
## Supported events:
- READY
- MESSAGE_CREATE
- MESSAGE_DELETE
- INTERACTION_CREATE