Merge branch 'main' into confirm-clear

This commit is contained in:
Astrid
2020-10-23 11:14:36 +02:00
committed by GitHub
25 changed files with 224 additions and 49 deletions

View File

@@ -23,10 +23,10 @@ namespace PluralKit.Bot {
else return true;
}
public static async Task<bool> PromptYesNo(this Context ctx, String msgString, DiscordUser user = null, Duration? timeout = null, IEnumerable<IMention> mentions = null)
public static async Task<bool> PromptYesNo(this Context ctx, String msgString, DiscordUser user = null, Duration? timeout = null, IEnumerable<IMention> mentions = null, bool matchFlag = true)
{
DiscordMessage message;
if (ctx.MatchFlag("y", "yes")) return true;
if (matchFlag && ctx.MatchFlag("y", "yes")) return true;
else message = await ctx.Reply(msgString, mentions: mentions);
var cts = new CancellationTokenSource();
if (user == null) user = ctx.Author;

View File

@@ -52,6 +52,9 @@ namespace PluralKit.Bot
// Ignore "Database is shutting down" error
if (e is PostgresException pe && pe.SqlState == "57P03") return false;
// Ignore thread pool exhaustion errors
if (e is NpgsqlException npe && npe.Message.Contains("The connection pool has been exhausted")) return false;
// This may expanded at some point.
return true;
}