Skip to content

Humans-of-Julia/Ekztazy.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation Build
Stable Dev CI

Ekztazy.jl is the spiritual successor to Discord.jl. It is a maintained Julia Pkg for creating simple yet efficient Discord bots.

  • Strong, expressive type system: No fast-and-loose JSON objects here.
  • Non-blocking: API calls return immediately and can be awaited when necessary.
  • Simple: Multiple dispatch allows for a small, elegant core API.
  • Fast: Julia is fast like C but still easy like Python.
  • Robust: Resistant to bad event handlers and/or requests. Errors are introspectible for debugging.
  • Lightweight: Cache what is important but shed dead weight with TTL.
  • Gateway independent: Ability to interact with Discord's API without establishing a gateway connection.
  • Distributed: Process-based sharding requires next to no intervention and you can even run shards on separate machines.

Ekztazy.jl can be added like this:

] add Ekztazy

Example

# Discord Token and Application ID should be saved in Env vars
client = Client()

# Guild to register the command in 
TESTGUILD = ENV["TESTGUILD"]

command!(client, TESTGUILD, "double", "Doubles a number!", options=[opt(name="number", description="The number to double!")]) do (ctx) 
    Ekztazy.reply(client, ctx, content="$(parse(Int, opt(ctx)["number"])*2)")
end

on_ready!(client) do (ctx)
    @info "Successfully logged in as $(ctx.user.username)"
end

start(client)

Many thanks to @Xh4H for Discord.jl which this relied heavily on.