Skip to content

Commit 327f25f

Browse files
Merge remote-tracking branch 'upstream/dev' into bugfix/fix-some-unittests-configuration
2 parents c3f6d13 + abce1b2 commit 327f25f

File tree

3 files changed

+227
-212
lines changed

3 files changed

+227
-212
lines changed

Fritz.Chatbot/Commands/HelpCommand.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public async Task Execute(IChatService chatService, string userName, ReadOnlyMem
2727

2828
if (rhs.IsEmpty)
2929
{
30-
var availableCommands = String.Join(" ", commands.Where(c => !string.IsNullOrEmpty(c.Trigger)).Select(c => $"!{c.Trigger.ToLower()}"));
30+
31+
var availableCommandArray = commands.Where(c => !string.IsNullOrEmpty(c.Trigger)).Select(c => $"!{c.Trigger.ToLower()}");
32+
var textCommandArray = TextCommand._Commands.Select(kv => "!" + kv.Key.ToLower());
33+
34+
var availableCommands = string.Join(' ', availableCommandArray.Union(textCommandArray).OrderBy(s => s));
3135

3236
await chatService.SendMessageAsync($"Supported commands: {availableCommands}");
3337
return;

Fritz.Chatbot/Commands/TextCommand.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@ public class TextCommand : IExtendedCommand
1818
public bool Final => true;
1919
public TimeSpan? Cooldown => TimeSpan.FromSeconds(5);
2020

21-
private static readonly Dictionary<string, string> _Commands = new Dictionary<string, string>
21+
internal static readonly Dictionary<string, string> _Commands = new Dictionary<string, string>
2222
{
2323
{ "music", "Jeff plays 'Music to Code By' from Carl Franklin: http://mtcb.pwop.com" },
2424
{ "discord", "Join us on the Fritz and Friends Discord server at: https://discord.gg/RnJhrJq" },
2525
{ "github", "Checkout Jeff's GitHub at: https://github.com/csharpfritz" },
2626
{ "keyboard", "Jeff uses a Vortex Race 3 with Cherry MX Blue switches, details on his blog at: https://jeffreyfritz.com/2018/07/mechanical-keyboards-i-just-got-one-and-why-you-need-one-too/" },
2727
{ "blog", "Jeff's blog is at: https://jeffreyfritz.com" },
28-
{ "lurk", "is stepping away from keyboard and lurking" }
28+
{ "lurk", "is stepping away from keyboard and lurking" },
29+
{ "defend", "csharpNo csharpGritty We shall defend the channel! csharpNo csharpGritty" },
30+
{ "raid", @"Prepare to RAID! Copy this text to use when we reach our raid target: ------------ Subscribers copy ------------- csharpRaid csharpRaid csharpRaid CsharpFritz's Coding Squad is Here! All your base are belong to us! csharpRaid csharpRaid csharpRaid " +
31+
" ------------ Non-Subscribers copy ------------- twitchRaid twitchRaid twitchRaid CsharpFritz's Coding Squad is Here! All your base are belong to us! twitchRaid twitchRaid twitchRaid " }
2932
};
3033

34+
internal static bool IsCommand(string commandText)
35+
{
36+
37+
return _Commands.ContainsKey(commandText);
38+
39+
}
40+
3141
public bool CanExecute(string userName, string fullCommandText)
3242
{
3343

0 commit comments

Comments
 (0)