diff options
author | TrueDoctor <d-kobert@web.de> | 2018-06-11 23:51:33 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-06-11 23:51:33 +0200 |
commit | 980bfbb8578e8f71a23ec6c90d55eda638bebb4b (patch) | |
tree | 05976dff79131c1ac683092f94a123d6d793bf61 /DiscoBot | |
parent | 1d36610c1f99b671e159228c03224a4b3ebfe140 (diff) |
added option to send the message directly to the user
Diffstat (limited to 'DiscoBot')
-rw-r--r-- | DiscoBot/Auxiliary/CommandExtension.cs | 20 |
1 files changed, 17 insertions, 3 deletions
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<string> message) + public static async Task ReplyAsync(this ModuleBase m, IEnumerable<string> 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<string> message, TimeSpan time) |