Skip to content
MoonScript IRC bot
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
plugins plugins/data: Add storage for vars that should only persist with the … Jun 7, 2019
.editorconfig .editorconfig: add basic configuration Nov 22, 2016
.gitignore Add SASL, :wrap_iter, rewrite process format May 13, 2019
.vimrc .vimrc: add base vim rc file Nov 23, 2016
ISSUE_TEMPLATE.md Create ISSUE_TEMPLATE.md Feb 29, 2016
LICENSE
README.md README: dis now MoonScript irc bot, not Lua May 13, 2019
compile.sh compile.sh: add options for compiling Oct 26, 2018
config.ld config.ld: add LDoc config Nov 22, 2016
irc.moon
logger.moon *.moon: improve async support, priorities, async typing Jun 7, 2019
logo logo: lolcat Nov 23, 2016
main.moon main: use MoonScript instead of Lua, fixes debugging May 13, 2019
start.sh start.sh: MoonScript, not Lua May 13, 2019

README.md

General Information

Project Information

Moon-Moon is an IRC bot run with the Lua programming language; however, the syntax used in the development version is called 'MoonScript' - this syntax can be compiled using Leafo's MoonScript program moonc and then loaded as Lua bytecode.

Dependencies

Lua

LuaRocks (recommended)

MoonScript

pgmoon

basexx

cqueues

luafilesystem

Getting Started

Installing Dependencies with LuaRocks

To install rocks locally, pass the --local flag to the luarocks command. This downloads and installs rocks to a local directory without requiring access to system directories. LuaRocks is recommended to allow for easy installation of all the required software.

$ luarocks install cqueues
$ luarocks install luafilesystem
$ luarocks install moonscript # Optional

Configuration

Lua is used as a configuration language; bots must each have their own separate .lua file in $XDG_CONFIG_HOME/moonmoon (which defaults to $HOME/.config).

bot "#!" {
	server = "irc.hashbang.sh";
	port = 6697; -- TLS is automatically set if port == 6697
	autojoin = {
		"#!FusionScript";
	};
};

The Coroutine System

Moon Moon takes advantage of a coroutine-based asynchronous system which allows the software to have multiple things "running" at once - it's almost like having a threaded program, without threads. This offers some advantages:

  1. A single Lua state
  2. Fewer callbacks
  3. Cleaner code base

Adding in a routine to the queue is simple, as demonstrated by the below examples programmed in MoonScript and Lua for convenience:

MoonScript

cqueues = require 'cqueues'
queue   = require 'queue'

queue\wrap ->
	while true
		cqueues.sleep 5
		print 'Hello, World!'

Lua

local cqueues = require("cqueues")
local queue   = require("queue")
queue:wrap(function()
	while true do
		cqueues.sleep(5)
		print("Hello, World!")
	end
end)
You can’t perform that action at this time.