summaryrefslogtreecommitdiff
path: root/DiscoBot
diff options
context:
space:
mode:
Diffstat (limited to 'DiscoBot')
-rw-r--r--DiscoBot/Auxiliary/CommandExtension.cs37
-rw-r--r--DiscoBot/Auxiliary/Extensions.cs1
2 files changed, 38 insertions, 0 deletions
diff --git a/DiscoBot/Auxiliary/CommandExtension.cs b/DiscoBot/Auxiliary/CommandExtension.cs
index 5d07f6c..8e8d7fb 100644
--- a/DiscoBot/Auxiliary/CommandExtension.cs
+++ b/DiscoBot/Auxiliary/CommandExtension.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
+ using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -43,6 +44,42 @@
messages.Where(x => x.Content.StartsWith($"#{token}\n") && x.Author.IsBot));
}
+ public static async Task ReplyAsync(this ModuleBase m, IEnumerable<string> message)
+ {
+ var sb = new StringBuilder();
+ foreach (string re in message)
+ {
+ if (sb.Length + re.Length > 1798)
+ {
+ await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```");
+
+ sb.Clear();
+ }
+
+ sb.AppendLine(re);
+ }
+
+ await m.Context.Channel.SendMessageAsync("```xl\n" + sb + "\n```");
+ }
+
+ public static async Task ReplyAsync(this ModuleBase m, IEnumerable<string> message, TimeSpan time)
+ {
+ var sb = new StringBuilder();
+ foreach (string re in message)
+ {
+ if (sb.Length + re.Length > 1798)
+ {
+
+ await m.ReplyTimedAsync(sb.ToString(), time);
+
+ sb.Clear();
+ }
+
+ sb.AppendLine(re);
+ }
+
+ await m.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90));
+ }
}
}
diff --git a/DiscoBot/Auxiliary/Extensions.cs b/DiscoBot/Auxiliary/Extensions.cs
index a1d58fa..fad5dd8 100644
--- a/DiscoBot/Auxiliary/Extensions.cs
+++ b/DiscoBot/Auxiliary/Extensions.cs
@@ -29,4 +29,5 @@
return temp + str;
}
}
+
}