Skip to content
This repository was archived by the owner on Sep 23, 2020. It is now read-only.

Creating Commands

LordRalex edited this page Nov 16, 2012 · 23 revisions

The RalexBot API Guide

If you wanted to add your own commands or listeners to the bot, then you are at the right place. This small guide will explain how to create commands and how to create your own event listeners.

Important Notices

There is a few things that you should know about the bot. When an event is fired, it is fired in a separate thread, so this means that a listener can be called by 2 different threads at the same time. You need to account for Concurrent access to the variables in classes to insure that there is not an issue on runtime in the event a listener is being concurrently modified.

Events can be cancelled, this means that a event can inform other listeners that they should not be running on the event. An example implentation of this is with the SilentCommand, which when active will cancel CommandEvents to tell other commands listeners they should not be replying to the event. The event will only pass to listeners that will ignore canceled events.

Overview

Both listeners and commands will extend the Listener class in the com.lordralex.ralexbot.api package. This class is the frame for any listener and is how the bot will know to use it.

--THIS IS UNDER REWRITE--

Creating Commands

--THIS IS UNDER REWRITE--

The getAliases() is called during runtime, so this means that this can be freely changed while the bot is running to allow for dynamic aliases. An example of this can be seen with the RemCommand or the RalexBotCommand, which both use dynamic aliases to keep updates on while commands are allowed.

Clone this wiki locally