Xh4H / Discord.jl

The Julia Discord API Wrapper
MIT License
151 stars 23 forks source link
api api-wrapper discord discord-jl julia library wrapper

Discord.jl

Documentation Build Status Information
Docs Build Status Discord License

Discord.jl is the solution for creating Discord bots with the Julia programming language.

Installation

First install Julia. Make sure you are running the latest version.

Discord.jl is not yet released. Add it from the Git repository with the following command:

# Enter ']' from the REPL to enter Pkg mode.
pkg> add https://github.com/Xh4H/Discord.jl

The above command will also update all of your dependencies, and store the configurations in ~/.julia.

Example

# Import Discord.jl.
using Discord
# Create a client.
c = Client("token"; presence=(game=(name="with Discord.jl", type=AT_GAME),))

# Create a handler for the MessageCreate event.
function handler(c::Client, e::MessageCreate)
    # Display the message contents.
    println("Received message: $(e.message.content)")
    # Add a reaction to the message.
    create(c, Reaction, e.message, '👍')
end

# Add the handler.
add_handler!(c, MessageCreate, handler)
# Log in to the Discord gateway.
open(c)
# Wait for the client to disconnect.
wait(c)

For further examples, guides and reference please refer to the documentation linked above.

Contributing

Pull requests are welcome! In most cases, it will be helpful to discuss the change you would like to make on Discord before diving in too deep.

Credits

Big thanks to christopher-dG for developing this project with me, and also TheOnlyArtz for initially starting up this repository with me.