antiantiswearingbot/Jetsparrow.Aasb/Commands/UnlearnCommand.cs
2023-03-26 22:40:44 +03:00

26 lines
624 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Jetsparrow.Aasb.Services;
namespace Jetsparrow.Aasb.Commands;
public class UnlearnCommand : IChatCommand
{
public bool Authorize => true;
SearchDictionary Dict { get; }
public UnlearnCommand(SearchDictionary dict)
{
Dict = dict;
}
public string Execute(CommandContext cmd)
{
var word = cmd.Parameters.FirstOrDefault();
if (string.IsNullOrWhiteSpace(word))
return null;
if (Dict.Unlearn(word))
return $"Больше не буду";
else
return $"А я и не знаю что такое \"{word}\"";
}
}