Better API
SoniEx2 opened this issue ยท 6 comments
Well a way to control the chat output with Lua scripts would be cool.
That way we can parse IRC messages and turn bot messages into chat messages, so it's less... bloated, and feels like you're playing on a server, kinda.
For example, the Queercraft IRC bot, on #queercraft @ EsperNet
. I have a HexChat plugin that makes the bot messages look like normal IRC messages. It would be cool to be able to write similar plugins for use with EiraIRC.
Altho maybe an Event API (API based on Forge events) would be better, as it would allow the plugins to be written in any language.
Here's my idea for an event-based API:
IRCEvent.java
// add imports here
// annotations for cancellable and has result
public class IRCEvent extends Event {
public final IRCNetwork network;
public ChatComponent chatMessage; // the thing that shows up in in-game chat, if the result is set to ALLOW
// add constructor here
}
IRCChannelEvent.java
// add imports here
public class IRCChannelEvent extends IRCEvent {
public final IRCChannel channel;
// add constructor here
}
IRCChannelMessageEvent.java
// add imports here
public class IRCChannelMessageEvent extends IRCChannelEvent {
public final User user; // this includes hostname, nickname, ident, nickserv username, etc and can be expanded as needed
public final String message; // the contents of the message
// maybe it'd be better to make this "IRCMessageEvent" and have an optional "channel" field, actually.
// add constructor here
}
It's obviously a rough draft but w/e. (ps please read the comments)
After that it's all a matter of hooking it up to LuaJ or something.
EiraIRC already has an event-based API:
https://github.com/blay09/EiraIRC/tree/master/src/api/java/net/blay09/mods/eirairc/api
O I see.
Apparently it doesn't let me implement CTCPs (or custom events) tho, so it's shit. (e.g. I can't hook raw server lines)