README.md 1.12 KB
Newer Older
WebFreak001's avatar
WebFreak001 committed
1 2 3 4
# bancho-irc

[osu!](https://osu.ppy.sh) IRC client library basically only compatible with bancho due to `\n` line endings and very limited IRC commands.

WebFreak001's avatar
WebFreak001 committed
5
## [Documentation](https://webfreak001.github.io/bancho-irc/index.html)
WebFreak001's avatar
WebFreak001 committed
6

7
## Example
WebFreak001's avatar
WebFreak001 committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

```d
auto users = ["WebFreak", "Node"];
OsuRoom room = banchoConnection.createRoom("bob");
runTask({
	foreach (user; users)
		room.invite(user);
});
runTask({
	room.password = "123456";
	room.size = 8;
	room.mods = [Mod.Hidden, Mod.DoubleTime];
	room.map = "1158325";
});
runTask({
	int joined;
	try
	{
		while (true)
		{
			string user = room.waitForJoin(30.seconds);
			joined++;
			room.sendMessage("yay welcome " ~ user ~ "!", HighPriority.yes);
		}
	}
	catch (InterruptException)
	{
		if (joined == 0)
		{
			// forever alone
			room.close();
			return;
		}
	}
	room.sendMessage("This is an automated test, this room will close in 10 seconds on timer");
	room.setTimer(10.seconds);
	try
	{
		room.waitForTimer(15.seconds);
	}
	catch (InterruptException)
	{
		room.sendMessage("Timer didn't trigger :(");
		room.sendMessage("closing the room in 5s");
		sleep(5.seconds);
	}
	room.close();
}).join();
```