add internal gomuks command support

This commit is contained in:
Henry Hiles 2026-11-03 14:11:39 -05:00
commit 8650c44266
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -0,0 +1,44 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:nexus/controllers/client.dart";
import "package:nexus/models/bot_command.dart";
class GomuksCommandsController extends AsyncNotifier<IList<BotCommand>> {
static const unsupported = ISetConst({
// Needs gomuks web
"devtools",
"upgraderoom",
// Needs attachment stuff
"myroomavatar",
"globalavatar",
"roomavatar",
// Already in Nexus' UI with a better UX
"poll",
});
@override
Future<IList<BotCommand>> build() async =>
(await ref
.read(ClientController.provider.notifier)
.getCommandDefinitions())
.where(
(description) =>
description.isValid &&
!unsupported.contains(description.command),
)
.map(
(description) => BotCommand(
sender: BotCommand.gomuksSender,
botName: "gomuks",
description: description,
),
)
.toIList();
static final provider =
AsyncNotifierProvider<GomuksCommandsController, IList<BotCommand>>(
GomuksCommandsController.new,
);
}