summaryrefslogtreecommitdiff
path: root/DiscoBot/Auxiliary
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-06-11 23:51:33 +0200
committerTrueDoctor <d-kobert@web.de>2018-06-11 23:51:33 +0200
commit980bfbb8578e8f71a23ec6c90d55eda638bebb4b (patch)
tree05976dff79131c1ac683092f94a123d6d793bf61 /DiscoBot/Auxiliary
parent1d36610c1f99b671e159228c03224a4b3ebfe140 (diff)
added option to send the message directly to the user
Diffstat (limited to 'DiscoBot/Auxiliary')
-rw-r--r--DiscoBot/Auxiliary/CommandExtension.cs20
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)