Dm help string now allows usage of embed strings
This commit is contained in:
parent
5d4fdea620
commit
b6a1e9a420
@ -24,7 +24,6 @@ namespace NadekoBot.Modules.Help
|
|||||||
private readonly GlobalPermissionService _perms;
|
private readonly GlobalPermissionService _perms;
|
||||||
|
|
||||||
public string HelpString => String.Format(_config.BotConfig.HelpString, _creds.ClientId, Prefix);
|
public string HelpString => String.Format(_config.BotConfig.HelpString, _creds.ClientId, Prefix);
|
||||||
public string DMHelpString => _config.BotConfig.DMHelpString;
|
|
||||||
|
|
||||||
public Help(IBotCredentials creds, GlobalPermissionService perms, IBotConfigProvider config, CommandService cmds)
|
public Help(IBotCredentials creds, GlobalPermissionService perms, IBotConfigProvider config, CommandService cmds)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,8 @@ using NadekoBot.Common.Attributes;
|
|||||||
using NadekoBot.Common.ModuleBehaviors;
|
using NadekoBot.Common.ModuleBehaviors;
|
||||||
using NadekoBot.Core.Services;
|
using NadekoBot.Core.Services;
|
||||||
using NadekoBot.Core.Services.Impl;
|
using NadekoBot.Core.Services.Impl;
|
||||||
|
using NadekoBot.Common;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Help.Services
|
namespace NadekoBot.Modules.Help.Services
|
||||||
{
|
{
|
||||||
@ -17,26 +19,34 @@ namespace NadekoBot.Modules.Help.Services
|
|||||||
private readonly IBotConfigProvider _bc;
|
private readonly IBotConfigProvider _bc;
|
||||||
private readonly CommandHandler _ch;
|
private readonly CommandHandler _ch;
|
||||||
private readonly NadekoStrings _strings;
|
private readonly NadekoStrings _strings;
|
||||||
|
private readonly Logger _log;
|
||||||
|
|
||||||
public HelpService(IBotConfigProvider bc, CommandHandler ch, NadekoStrings strings)
|
public HelpService(IBotConfigProvider bc, CommandHandler ch, NadekoStrings strings)
|
||||||
{
|
{
|
||||||
_bc = bc;
|
_bc = bc;
|
||||||
_ch = ch;
|
_ch = ch;
|
||||||
_strings = strings;
|
_strings = strings;
|
||||||
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LateExecute(DiscordSocketClient client, IGuild guild, IUserMessage msg)
|
public Task LateExecute(DiscordSocketClient client, IGuild guild, IUserMessage msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (guild == null)
|
if (guild == null)
|
||||||
await msg.Channel.SendMessageAsync(_bc.BotConfig.DMHelpString).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
{
|
||||||
//ignore
|
if (CREmbed.TryParse(_bc.BotConfig.DMHelpString, out var embed))
|
||||||
|
return msg.Channel.EmbedAsync(embed.ToEmbed(), embed.PlainText?.SanitizeMentions() ?? "");
|
||||||
|
|
||||||
|
return msg.Channel.SendMessageAsync(_bc.BotConfig.DMHelpString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Warn(ex);
|
||||||
|
}
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
public EmbedBuilder GetCommandHelp(CommandInfo com, IGuild guild)
|
public EmbedBuilder GetCommandHelp(CommandInfo com, IGuild guild)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user