diff --git a/lib/src/commands/feature_settings.dart b/lib/src/commands/feature_settings.dart index eecc407..a1eb2eb 100644 --- a/lib/src/commands/feature_settings.dart +++ b/lib/src/commands/feature_settings.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import 'package:injector/injector.dart'; import 'package:nyxx/nyxx.dart'; import 'package:nyxx_commands/nyxx_commands.dart'; @@ -88,5 +89,24 @@ final featureSettings = ChatGroup( return context.respond(paginator); }), options: CommandOptions(defaultResponseLevel: ResponseLevel.private)), + ChatCommand( + 'list', + 'List available settings', + id('settings-list', (ChatContext context) async { + final embeds = Setting.values.map((s) { + return EmbedBuilder(title: s.name, description: s.description, fields: [ + if (s.requiresData) + EmbedFieldBuilder(name: 'Example data (if requires)', value: s.example!, isInline: true), + if (s.requiresData) + EmbedFieldBuilder(name: 'Data type (if requires)', value: s.type.toString(), isInline: true), + ]); + }); + + final builders = embeds.slices(4).map((embeds) => MessageBuilder(embeds: embeds)).toList(); + + final paginator = await pagination.builders(builders); + return context.respond(paginator); + }), + ), ], ); diff --git a/lib/src/models/feature_settings.dart b/lib/src/models/feature_settings.dart index 6023d0b..2250158 100644 --- a/lib/src/models/feature_settings.dart +++ b/lib/src/models/feature_settings.dart @@ -10,15 +10,18 @@ enum DataType { enum Setting { poopName('poop_name', 'Replace nickname of a member with poop emoji if the member tries to hoist itself', false), - joinLogs('join_logs', 'Logs member join events into specified channel', true, DataType.channelMention), - modLogs('mod_logs', 'Logs administration event into specified channel', true, DataType.channelMention), + joinLogs('join_logs', 'Logs member join events into specified channel', true, + type: DataType.channelMention, example: '419506523467939853'), + modLogs('mod_logs', 'Logs administration event into specified channel', true, + type: DataType.channelMention, example: '419506523467939853'), jellyfin('jellyfin', 'Allows usage of jellyfin commands', true, - DataType.json), // {"create_instance_role":"419506523467939853"} + type: DataType.json, example: '{"create_instance_role":"419506523467939853"}'), mentions('mentions', 'Monitors messages for mention abuse', false), kavita('kavita', 'Allows usage of jellyfin command', true, - DataType.json), // {"create_instance_role":"419506523467939853"} + type: DataType.json, example: '{"create_instance_role":"419506523467939853"}'), emojiReact('emoji_react', 'React to predefined words with emojis', true, - DataType.string); //{"use_builtin": true|false, "mode": "react|message", "process_other_bots": false} + type: DataType.json, + example: '{"use_builtin": true|false, "mode": "react|message", "process_other_bots": true|false}'); /// name of setting final String name; @@ -32,7 +35,10 @@ enum Setting { /// Type of data final DataType? type; - const Setting(this.name, this.description, this.requiresData, [this.type]); + /// Example data for setting + final String? example; + + const Setting(this.name, this.description, this.requiresData, {this.example, this.type}); } /// The value of a setting within a guild.