From 21f8718b46fab7851cf45b5c674f1993c90b6ec2 Mon Sep 17 00:00:00 2001 From: jetsparrow Date: Wed, 19 Dec 2018 15:35:53 +0300 Subject: [PATCH] remove EchoCommand and DefineCommand --- JetKarmaBot/Commands/DefineCommand.cs | 43 --------------------------- JetKarmaBot/Commands/EchoCommand.cs | 22 -------------- JetKarmaBot/JetKarmaBot.cs | 2 -- 3 files changed, 67 deletions(-) delete mode 100644 JetKarmaBot/Commands/DefineCommand.cs delete mode 100644 JetKarmaBot/Commands/EchoCommand.cs diff --git a/JetKarmaBot/Commands/DefineCommand.cs b/JetKarmaBot/Commands/DefineCommand.cs deleted file mode 100644 index 5659b13..0000000 --- a/JetKarmaBot/Commands/DefineCommand.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Telegram.Bot; -using Telegram.Bot.Args; -using Telegram.Bot.Types.Enums; - -namespace JetKarmaBot.Commands -{ - public class DefineCommand : IChatCommand - { - Dictionary m_Definitions = new Dictionary() - { - { "AbstractSingletonProxyFactoryBean", "*Convenient* superclass for FactoryBean types that produce singleton-scoped proxy objects." } - }; - - ITelegramBotClient m_client; - public DefineCommand(ITelegramBotClient client) - { - m_client = client; - } - - public IReadOnlyCollection Names => new[] {"define" }; - - public bool Execute(object sender, MessageEventArgs messageEventArgs) - { - var commandTerms = messageEventArgs.Message.Text.Split(' ', StringSplitOptions.RemoveEmptyEntries); - var chatId = messageEventArgs.Message.Chat.Id; - foreach (var term in commandTerms.Skip(1)) - { - if (m_Definitions.ContainsKey(term)) - { - m_client.SendTextMessageAsync(chatId, m_Definitions[term], parseMode: ParseMode.Markdown); - return true; - } - } - m_client.SendTextMessageAsync(chatId, "idk lol"); - return false; - } - } -} diff --git a/JetKarmaBot/Commands/EchoCommand.cs b/JetKarmaBot/Commands/EchoCommand.cs deleted file mode 100644 index 5e47b1f..0000000 --- a/JetKarmaBot/Commands/EchoCommand.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; -using Telegram.Bot; -using Telegram.Bot.Args; - -namespace JetKarmaBot.Commands -{ - public class EchoCommand : IChatCommand - { - ITelegramBotClient m_client; - public EchoCommand(ITelegramBotClient client) - { - m_client = client; - } - public IReadOnlyCollection Names => new[] { "echo" }; - - public bool Execute(object sender, MessageEventArgs args) - { - m_client.SendTextMessageAsync(args.Message.Chat.Id, args.Message.Text); - return true; - } - } -} diff --git a/JetKarmaBot/JetKarmaBot.cs b/JetKarmaBot/JetKarmaBot.cs index 9f72e27..ee41dde 100644 --- a/JetKarmaBot/JetKarmaBot.cs +++ b/JetKarmaBot/JetKarmaBot.cs @@ -66,8 +66,6 @@ namespace JetKarmaBot { commands = new ChatCommandRouter(); commands.Add(new StartCommand(db)); - commands.Add(new EchoCommand(client)); - commands.Add(new DefineCommand(client)); commands.Add(new AwardCommand(db, client, me)); }