29 lines
715 B
Dart
29 lines
715 B
Dart
import "package:cozybot/controllers/client_controller.dart";
|
|
import "package:riverpod/riverpod.dart";
|
|
|
|
class RecordController extends Notifier<String> {
|
|
@override
|
|
String build() {
|
|
ref.watch(ClientController.provider).on("message", (
|
|
_,
|
|
userstate,
|
|
message,
|
|
_,
|
|
) {
|
|
if (userstate["username"] == "streamlabs") {
|
|
final match = RegExp(
|
|
r"\d+[Ww]?-\d+[Ll]?",
|
|
).allMatches(message).lastOrNull;
|
|
final group = match?.group(0);
|
|
if (group == null) return;
|
|
state = "Record:\n$group";
|
|
}
|
|
});
|
|
|
|
return "Record:\n0-0";
|
|
}
|
|
|
|
static final provider = NotifierProvider<RecordController, String>(
|
|
RecordController.new,
|
|
);
|
|
}
|