add def lookup for missing commands
This commit is contained in:
parent
708bf7409e
commit
323d17e89d
|
@ -3,6 +3,8 @@ using Discord.WebSocket;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using dotbot.Core;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace dotbot.Services
|
namespace dotbot.Services
|
||||||
{
|
{
|
||||||
|
@ -44,6 +46,18 @@ namespace dotbot.Services
|
||||||
if (!result.IsSuccess) // If not successful, reply with the error.
|
if (!result.IsSuccess) // If not successful, reply with the error.
|
||||||
await context.Channel.SendMessageAsync(result.ToString());
|
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)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue