Skip to content
Discord API library written in Lua for the Luvit runtime environment
Branch: master
Clone or download
DrLynix and SinisterRectus Fix Member:hasPermission returning false in some conditions for admins (

* Fix Member:hasPermission returning false in some conditions for admins

Like if channel disallow everyone to see it, it would return false for the read permission, even for admins

* Make use of has function and fix typo
Latest commit 966861e Apr 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Added markdown file extension to README Mar 25, 2018
libs Fix Member:hasPermission returning false in some conditions for admins ( Apr 19, 2019 Bumped to version 2.6.0 Oct 3, 2018
LICENSE License update for 2018 (#110) Mar 22, 2018 Removed donation link Jan 5, 2019
docgen.lua fix docgen, fix typos in docstrings (#165) Jan 20, 2019
init.lua Removed Buffer class Jan 18, 2018
package.lua Bumped to version 2.6.0 Oct 3, 2018


Discord API library written in Lua for the Luvit runtime environment


Discord is a freeware, multi-platform, voice and text client designed for gamers. It has a documented RESTful API that allows developers to make Discord bots for use on their servers.

Luvit is an open-source, asynchronous I/O Lua runtime environment. It is a combination of LuaJIT and libuv, layered with various libraries to provide server-side functionality similar to that of Node.js, but with Lua instead of JavaScript. Luvit's companion package manager, lit, makes it easy to set up the Luvit runtime and its published libraries.

Discordia is a Lua wrapper for the official Discord API, and provides a high-level, object-oriented, event-driven interface for developing Discord bots. By using Lua's native coroutines, asynchronous HTTP and WebSocket communication is internally abstracted in a way that allows end-users to write blocking-style code without blocking I/O operations.

Join the Discord API community to discuss Discordia and other Discord libraries!


  • To install Luvit, visit and follow the instructions provided for your platform.
  • To install Discordia, run lit install SinisterRectus/discordia
  • Run your bot script using, for example, luvit bot.lua


local discordia = require('discordia')
local client = discordia.Client()

client:on('ready', function()
	print('Logged in as '.. client.user.username)

client:on('messageCreate', function(message)
	if message.content == '!ping' then'Pong!')

client:run('Bot INSERT_TOKEN_HERE')


Please visit this project's Wiki for documentation and tutorials.


The earliest version of Discordia, before it even had that name, was released as a Just Cause 2 Multiplayer module on 7 March 2016. It utilized LuaSocket, LuaSec, and (eventually) Copas to provide basic REST functionality in a sandboxed Lua 5.2 environment. The goal was to bridge the game chat with a Discord client. Due to a lack of WSS support (at the time), the project was put on hold in favor of a general-purpose Lua library for Discord. After finishing a relatively stable version of Discordia, the JC2MP bridge was re-designed to connect with Discordia via inter-process communication.


Why Lua?

  • Lua is a lightweight scripting language that tends to be beginner-friendly, but powerful in the hands of an advanced user at the same time. Although Lua might not have the same popularity as that of other scripting languages such as Python or JavaScript, Lua's expandability makes it equally as capable as the others, while remaining easy-to-use and often more resource efficient.

Why Luvit?

  • Luvit makes Lua web development an easy task on multiple platforms. Its installation process is (optionally) automated and uses pre-built luvi cores when available. It also comes with many libraries essential to async I/O programming and networking. Compared to Node.js, Luvit advertises similar speed, but reduced memory consumption. Compared to other Discord libraries, Discordia is expected to perform well due Luvit's use of LuaJIT, although it has not been benchmarked.

Can I run this on a different Lua distribution?

  • The development and deployment of Discordia relies on the Luvit framework and its package manager. Porting Discordia and its dependencies to classic Lua or LuaJIT may be possible, but this is not a current project goal.

How can I contribute?

  • Pull requests are welcomed, but please check with the library author before starting a major implementation. Contributions to the Wiki are helpful, too.

Are there other Discord libraries?

  • Absolutely. Check the official libraries page of the Discord API documentation or the unofficial Discord API server linked above.
You can’t perform that action at this time.