From 980bfbb8578e8f71a23ec6c90d55eda638bebb4b Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Mon, 11 Jun 2018 23:51:33 +0200 Subject: added option to send the message directly to the user --- DiscoBot/Auxiliary/CommandExtension.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'DiscoBot/Auxiliary') diff --git a/DiscoBot/Auxiliary/CommandExtension.cs b/DiscoBot/Auxiliary/CommandExtension.cs index 8e8d7fb..973bafa 100644 --- a/DiscoBot/Auxiliary/CommandExtension.cs +++ b/DiscoBot/Auxiliary/CommandExtension.cs @@ -44,14 +44,21 @@ messages.Where(x => x.Content.StartsWith($"#{token}\n") && x.Author.IsBot)); } - public static async Task ReplyAsync(this ModuleBase m, IEnumerable message) + public static async Task ReplyAsync(this ModuleBase m, IEnumerable message, bool directMessage = false) { var sb = new StringBuilder(); foreach (string re in message) { if (sb.Length + re.Length > 1798) { - await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```"); + if (directMessage) + { + await m.Context.User.SendMessageAsync("```xl\n" + sb + "\n```"); + } + else + { + await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```"); + } sb.Clear(); } @@ -59,7 +66,14 @@ sb.AppendLine(re); } - await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```"); + if (directMessage) + { + await m.Context.User.SendMessageAsync("```xl\n" + sb + "\n```"); + } + else + { + await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```"); + } } public static async Task ReplyAsync(this ModuleBase m, IEnumerable message, TimeSpan time) -- cgit v1.2.3-54-g00ecf