Class BanchoBot
Represents a Bancho IRC connection.
class BanchoBot
;
Constructors
Name | Description |
---|---|
this
|
Prepares a bancho IRC connection with username & password (can be obtained from https://osu.ppy.sh/p/irc) |
Fields
Name | Type | Description |
---|---|---|
backlogsMessage
|
Message[256] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
backlogsMessage
|
Message[256] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
backlogsQuit
|
Quit[256] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
backlogsQuit
|
Quit[256] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
backlogsTopic
|
TopicChange[8] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
backlogsTopic
|
TopicChange[8] | list of backlog which hasn't been handled by any event subscribers, oldest one will always be replaced on new ones. |
client
|
vibe | |
password
|
string | |
processorsMessage
|
bool delegate(Message) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
processorsMessage
|
bool delegate(Message) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
processorsQuit
|
bool delegate(Quit) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
processorsQuit
|
bool delegate(Quit) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
processorsTopic
|
bool delegate(TopicChange) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
processorsTopic
|
bool delegate(TopicChange) | list of event subscribers. Gets removed automatically when called and returns true, otherwise caller has to remove it. |
rooms
|
OsuRoom[] | |
username
|
string |
Methods
Name | Description |
---|---|
clear
|
Clears all logs, called by connect |
clearMessageLog
|
Clears all backlog & removes all event listeners for the object type. |
clearMessageLog
|
Clears all backlog & removes all event listeners for the object type. |
clearQuitLog
|
Clears all backlog & removes all event listeners for the object type. |
clearQuitLog
|
Clears all backlog & removes all event listeners for the object type. |
clearTopicLog
|
Clears all backlog & removes all event listeners for the object type. |
clearTopicLog
|
Clears all backlog & removes all event listeners for the object type. |
connect
|
Connects to irc.ppy.sh:6667 and authenticates with username & password. Blocks and processes all messages sent by the TCP socket. Recommended to be called in runTask. Cleans up on exit properly and is safe to be called again once returned. |
createRoom
|
Creates a new managed room with a title and returns it. Automatically gets room ID & game ID. |
disconnect
|
Disconnects & closes the TCP socket. |
fetchOldMessageLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
fetchOldMessageLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
fetchOldQuitLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
fetchOldQuitLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
fetchOldTopicLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
fetchOldTopicLog
|
Goes through the backlog and removes and optionally returns all matching objects. |
preProcessMessage
|
Processes messages meant for mutliplayer rooms to update their state. called by mixin template |
processMessage
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
processMessage
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
processQuit
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
processQuit
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
processTopic
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
processTopic
|
Calls all event subscribers to try to match this object, otherwise replace the oldest element in the backlog with this. |
sendMessage
|
Sends a message to a username or channel (#channel). |
unmanageRoom
|
internal function to remove a room from the managed rooms list |
waitForMessage
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
waitForMessage
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
waitForMessageBunch
|
Waits for multiple messages sent at once and returns them. |
waitForQuit
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
waitForQuit
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
waitForTopic
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
waitForTopic
|
Waits for an event or returns one which is in the backlog already. Removes matching backlog entries. |
Examples
BanchoBot bot = new BanchoBot("User", "hunter2");
runTask({
while (true)
{
bot .connect();
logDiagnostic("Got disconnected from bancho...");
sleep(2 .seconds);
}
});