diff --git a/Services/CommandHandlerService.cs b/Services/CommandHandlerService.cs index 89a4f34..3be84cd 100644 --- a/Services/CommandHandlerService.cs +++ b/Services/CommandHandlerService.cs @@ -3,6 +3,8 @@ using Discord.WebSocket; using Microsoft.Extensions.Configuration; using System; using System.Threading.Tasks; +using dotbot.Core; +using System.Linq; namespace dotbot.Services { @@ -44,6 +46,18 @@ namespace dotbot.Services if (!result.IsSuccess) // If not successful, reply with the error. await context.Channel.SendMessageAsync(result.ToString()); } + else + { + using (var db = new DotbotDbContext()) + { + if (msg.HasStringPrefix(_config["prefix"], ref argPos)) + { + var key = msg.Content.Substring(_config["prefix"].Length); + if (db.Defs.Any(d => d.Id == key)) + await context.Channel.SendMessageAsync($"**{key}**: {db.Defs.Find(key)}"); + } + } + } } } }