Ranking
Prev Previous Post   Next Post Next
Original Post
[REL] Toribash Bot Library in Dart
Worked on this over the weekend, a library that makes it easy to write bots for Toribash.

I've written some documentation and have some examples on my GitHub:

- https://github.com/HelgeSverre/dart-toribash-bot
- https://pub.dev/packages/toribash_bot


If you want to check it out, please respect the bot rules here


Example of working bot code:

dart code:

import 'package:toribash_bot/credentials.dart';
import 'package:toribash_bot/events/room_connected.dart';
import 'package:toribash_bot/toribash_bot.dart';

main(List<String> args) async {
String roomName = "testroom";

ToribashBot bot = ToribashBot(
Credentials("USERNAME", "PASSWORD"),
);

bot.events.roomConnected.listen((RoomConnectedEvent event) {
Future.delayed(Duration(seconds: 5), () {
bot.say("Hello world!");
});

Future.delayed(Duration(seconds: 10), () {
bot.disconnect();
});
});

bot.join(roomName);
}



In the future I want to add events and functionality around controlling the match, parsing wins, handling bets, knowing when a turn happens etc, possibly add "replay" logging into it as well.

Tell me what you think.
Helge Sverre - System Developer
https://helgesverre.com