mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
remove EchoCommand and DefineCommand
This commit is contained in:
parent
58be680e4f
commit
21f8718b46
@ -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<string, string> m_Definitions = new Dictionary<string, string>()
|
||||
{
|
||||
{ "AbstractSingletonProxyFactoryBean", "*Convenient* superclass for FactoryBean types that produce singleton-scoped proxy objects." }
|
||||
};
|
||||
|
||||
ITelegramBotClient m_client;
|
||||
public DefineCommand(ITelegramBotClient client)
|
||||
{
|
||||
m_client = client;
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<string> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<string> Names => new[] { "echo" };
|
||||
|
||||
public bool Execute(object sender, MessageEventArgs args)
|
||||
{
|
||||
m_client.SendTextMessageAsync(args.Message.Chat.Id, args.Message.Text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user