Repository navigation
Signal.NET 0.5.0-preview.1
Pre-release
Pre-release
·
2 commits
to main
since this release
Milestone 0.5 (command system 2.0). Every change is binary-compatible with 0.4.0-preview.1: new members on existing
interfaces are default interface members, and new registration helpers are extension methods.
Added
- Command groups (roadmap 0.5.1):
[CommandGroup("playlist", Aliases = ["pl"])]on a module orICommandclass makes its commands/playlist add,/pl add, and so on. Module preconditions apply to the whole group.CommandDescriptor.Group(CommandGroupInfo) andFullName;ICommandRegistry.GetGroup(default interface member)./groupalone, or with an unknown subcommand, replies with the group's commands./help groupdescribes a group.
- Prompts (roadmap 0.5.2):
BackgroundWork.PromptAsync(question)andPromptAsync<T>(anyIParsable<T>, re-asking on invalid input) wait for the triggering sender's next message in the conversation, and return aPromptResult<T>(Answered,TimedOut,Invalid).- The host routes answers through the new
IPromptRegistrybefore partitioning. Commands (by the conversation's own prefixes) are never consumed as answers. - New option
Signal:Background:PromptTimeout(2 minutes).BackgroundWork.SenderandBackgroundWorkItem.Senderidentify who may answer.
- The host routes answers through the new
- Background work (roadmap 0.5.3):
CommandModule.RunInBackgroundAsync(work => …)(orMessageContext.QueueBackgroundWorkAsync, orIBackgroundWorkQueue) runs slow work outside the conversation partition, so later messages aren't held up.- Each item runs in its own DI scope and can reply to the original conversation with
work.ReplyAsync. - The queue is bounded and in memory, configured by
Signal:Background:MaxConcurrency(4) andCapacity(100).AddSignalhosts the processor (IBackgroundWorkProcessor). - At shutdown, running work is cancelled and queued items are dropped with a warning.
- Each item runs in its own DI scope and can reply to the original conversation with
- Scheduled messages (roadmap 0.5.4):
CommandModule.ScheduleReplyAsync/MessageContext.ScheduleReplyAsyncandIMessageScheduler(ScheduleAsync,ListAsync,CancelAsync) send text messages later, once or everyrepeatEvery(at least one minute).IScheduledMessageStoreis the persistence port; the default keeps messages in memory.AddSignalhosts the dispatcher, which checks everySignal:Scheduler:PollInterval(1 s) and retries failed sends afterRetryDelay(1 min).- After downtime, a recurring message sends one catch-up, not one per missed occurrence.
- Localisation (roadmap 0.5.5): every text the framework sends (errors, usage, help, precondition failures, prompt re-asks) goes through the new
ISignalTexts, with keys inTextKey.- Translations go under
Signal:Localization:Texts:{culture}:{key}. Lookup falls backde-AT→de→ English. - The culture is the conversation's
ConversationSettings.Culture, otherwiseLocalization:DefaultCulture. Cultures are plain names, so this works in invariant-globalization mode too. - Argument type names are translated via
Type.{English name}. Custom preconditions can useFail(context, key, args), andMessageContext.GetCultureAsync()exposes the culture. - English output is unchanged.
- Translations go under
- Roles (roadmap 0.5.6):
[RequireRole("moderator", Role.GroupAdmin)]passes when the sender has any listed role.- Roles come from
IRoleProviders:Signal:Commands:Roles(role → numbers or UUIDs),admin(includesCommands:Admins) andgroup-admin(Signal group admins, looked up live). AddRoleProvider<T>()adds your own provider, e.g. database-backed.IRoleServicechecks roles outside commands.
- Roles come from
- Per-conversation settings (roadmap 0.5.7):
ConversationSettingsper group or direct chat:Prefixes(replace the global ones there),DisabledCommands(full or group names) andCulture.- Stored through the new
IConversationSettingsStoreport (in memory by default) and read once per message viaMessageContext.GetConversationSettingsAsync(). - Disabled commands reply with
Commands:DisabledCommandMessage, and help and suggestions hide them. ICommandParser.TryParse(text, prefixes, …)is a new default interface member.
- Stored through the new
- Better help (roadmap 0.5.8):
/helplists commands under headings for each command group and[Category("…")](a flat list when there's only one section). It pages byCommands:HelpPageSize(default 20;/help 2)./help <command>shows[Example("…")]s.CommandDescriptor.CategoryandExamplesdescribe them. - "Did you mean …?" (roadmap 0.5.9): unknown-command replies suggest the closest visible command, alias, group or subcommand (
/hlep→ "Did you mean /help?"). Adjacent swaps count as one typo. Controlled byCommands:SuggestSimilarCommands(defaulttrue). - Collection parameters (roadmap 0.5.10):
params int[] numbers,List<PhoneNumber> people,IReadOnlyList<string> tags, and other array, list or collection-interface parameters take all remaining positional arguments, each converted (and@mention-resolved) individually.CommandParameter.ElementTypeandIsCollectiondescribe them. - Reaction commands (roadmap 0.5.11):
ReactionModulemethods with[OnReaction("👍")]run when someone reacts to the bot's messages (or any message withAnyMessage, removals withIncludeRemovals).- Emojis match regardless of skin tone and variation selector.
- Registered with
AddReactionModule<T>()orAddCommands(assembly); invalid handler signatures fail at registration.
Changed
- Cooldowns, usage lines, logs and
CommandDescriptor.ToString()use the full command name (playlist add). Nothing changes for commands outside a group. /helptakes the rest of the text, so/help playlist addworks.
What's Changed
- Validate against the 0.4.0-preview.1 baseline by @Nacorpio in #31
- Remove stray PublicAPI.Shipped.txt.new files by @Nacorpio in #32
- Add command groups and subcommands (0.5.1) by @Nacorpio in #33
- Suggest the closest command on typos (0.5.9) by @Nacorpio in #34
- Bind collection parameters from remaining arguments (0.5.10) by @Nacorpio in #35
- Improve help: sections, paging and examples (0.5.8) by @Nacorpio in #36
- Run slow command work in the background (0.5.3) by @Nacorpio in #37
- Add prompts to background work (0.5.2) by @Nacorpio in #38
- Add scheduled messages (0.5.4) by @Nacorpio in #39
- Add role-based permissions (0.5.6) by @Nacorpio in #40
- Add per-conversation settings (0.5.7) by @Nacorpio in #41
- Localise framework replies (0.5.5) by @Nacorpio in #42
- Add reaction commands (0.5.11) by @Nacorpio in #43
- Release v0.5.0-preview.1 by @Nacorpio in #44
Full Changelog: v0.4.0-preview.1...v0.5.0-preview.1