Skip to content

amatsagu/tempest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tempest library banner

Create lightning fast Discord Applications

Project: Tempest is a modern, minimal Discord library for building Discord Apps, written in Go. It aims to be extremely fast, stay very close to the Discord API, and include little to no caching - making it an excellent choice for small VPS or serverless architecture. In real-world projects using this lib, your bottlenecks will 9/10 cases be in the database or network bandwidth, not in app/bot itself.

It was created as a better alternative to discord-interactions-go, which is too low-level and outdated.

Features

  • Secure HTTPS-based communication with the Discord API using crypto/ed25519
  • Automatic dispatching of:
    • Application commands
    • Message components (buttons, select menu, text input)
    • Autocomplete interactions
    • Modal interactions
  • Built-in basic rate limit management that respects Discord’s HTTP limits
  • Full file upload support (message attachments) as stream (over x4 times faster than regular multipart creation)
  • Lightweight, fast command manager for auto handling slash commands, their auto complete and subcommands
  • Performance focused approach:
    • Structs only contain fields usable without a Gateway session
    • Essentially no caching for very low resource usage & easier hosting
  • Built-in helpers for component & modal interaction flow:
  • Helper structs and methods to manage:
    • Simple messages
    • Embeds
    • Components (buttons, string selects, sections, etc.)
    • Modals
    • Bitfields (flags, permissions, etc.)
    • Message Components v2
  • Exposed Rest client and all API structs which allows to easily extend library capabilities if needed
  • Basic support for Discord Monetization API (enough to get started)
  • Support for new HTTP event webhooks (planned):
    • Application Authorized
    • Application Deauthorized
    • Entitlement Create

HTTP vs Gateway

TL;DR: you probably should be using libraries like DiscordGo unless you know why you're here.

There are two ways for bots to receive events from Discord. Most API wrappers such as DiscordGo use a WebSocket connection called a "gateway" to receive events, but Tempest receives interaction events over HTTPS. Using http hooks lets you scale code more easily & reduce resource usage at cost of greatly reduced number of events you can use. You can easily create bots for roles, minigames, custom messages or admin utils but it'll be very difficult / impossible to create music or moderation bots.

Getting started

  1. Install with: go get -u github.com/amatsagu/tempest
  2. Check example with few simple commands.

Troubleshooting

For help feel free to open an issue on github. You can also inivite to contact me on discord.

Contributing

All contributions are welcomed. Few rules before making a pull request:

FOSSA Status

About

Fast and secure functions to build scalable Discord Applications.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 13