fix incorrect conditions

This commit is contained in:
Ben Harris 2017-12-05 12:15:02 -05:00
parent 323d17e89d
commit 0c7672ba84
1 changed files with 11 additions and 8 deletions

View File

@ -44,20 +44,23 @@ namespace dotbot.Services
var result = await _commands.ExecuteAsync(context, argPos, _provider); // Execute the command
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)}");
using (var db = new DotbotDbContext())
{
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)}");
return;
}
}
}
await context.Channel.SendMessageAsync(result.ToString());
}
}
}
}
}