Fixed dm help string

This commit is contained in:
Kwoth 2016-10-09 21:58:39 +02:00
parent ae998c36b3
commit 0c9fa4b453
3 changed files with 9 additions and 10 deletions

View File

@ -14,7 +14,7 @@ namespace NadekoBot.Modules.CustomReactions
{ {
public static Dictionary<string, Func<IUserMessage, string>> placeholders = new Dictionary<string, Func<IUserMessage, string>>() public static Dictionary<string, Func<IUserMessage, string>> placeholders = new Dictionary<string, Func<IUserMessage, string>>()
{ {
{"%mention%", (ctx) => { return $"<@!{NadekoBot.Client.GetCurrentUser().Id}>"; } }, {"%mention%", (ctx) => { return $"<@{NadekoBot.Client.GetCurrentUser().Id}>"; } },
{"%user%", (ctx) => { return ctx.Author.Mention; } }, {"%user%", (ctx) => { return ctx.Author.Mention; } },
{"%target%", (ctx) => { return ctx.MentionedUsers.Shuffle().FirstOrDefault()?.Mention ?? "Nobody"; } }, {"%target%", (ctx) => { return ctx.MentionedUsers.Shuffle().FirstOrDefault()?.Mention ?? "Nobody"; } },
{"%rng%", (ctx) => { return new NadekoRandom().Next(0,10).ToString(); } } {"%rng%", (ctx) => { return new NadekoRandom().Next(0,10).ToString(); } }

View File

@ -36,15 +36,6 @@ namespace NadekoBot.Modules.Help
public Help(ILocalization loc, CommandService cmds, ShardedDiscordClient client) : base(loc, cmds, client) public Help(ILocalization loc, CommandService cmds, ShardedDiscordClient client) : base(loc, cmds, client)
{ {
client.MessageReceived += async (msg) =>
{
if (msg.Author.IsBot)
return;
if (msg.Channel is IPrivateChannel)
{
await msg.Channel.SendMessageAsync(DMHelpString).ConfigureAwait(false);
}
};
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]

View File

@ -16,6 +16,7 @@ using Discord.Net;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using static NadekoBot.Modules.Permissions.Permissions; using static NadekoBot.Modules.Permissions.Permissions;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using NadekoBot.Modules.Help;
namespace NadekoBot.Services namespace NadekoBot.Services
{ {
@ -160,6 +161,13 @@ namespace NadekoBot.Services
await msg.Channel.SendMessageAsync(":warning: " + result.ErrorReason).ConfigureAwait(false); await msg.Channel.SendMessageAsync(":warning: " + result.ErrorReason).ConfigureAwait(false);
} }
} }
else
{
if (msg.Channel is IPrivateChannel)
{
await msg.Channel.SendMessageAsync(Help.DMHelpString).ConfigureAwait(false);
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {