1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-03 04:29:54 +03:00

time-out failsafes and new warnings

rewrote setting values in SettingsCommand.cs
fixed a bug with message edited notification on mobile
fixed an exploit with WrapInline where you could escape the code block by simply using `
moved a few things in MuteCommand.cs
cleaned up code
updated library to 3.3.2
This commit is contained in:
l1ttleO 2022-02-21 22:08:55 +05:00
parent e41a459f6f
commit 868b6bcaa7
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
12 changed files with 220 additions and 345 deletions

View file

@ -27,12 +27,12 @@ public static class Utils {
}
public static string Wrap(string original) {
var toReturn = original.Replace("```", "```");
var toReturn = original.Replace("```", "ˋˋˋ");
return $"```{toReturn}{(toReturn.EndsWith("`") || toReturn.Trim().Equals("") ? " " : "")}```";
}
public static string WrapInline(string original) {
return $"`{original}`";
return $"`{original.Replace("`", "ˋ")}`";
}
public static string MentionChannel(ulong id) {
@ -64,7 +64,7 @@ public static class Utils {
return await Boyfriend.Client.GetChannelAsync(ParseMention(mention));
}
public static async Task<IChannel?> ParseChannelNullable(string mention) {
private static async Task<IChannel?> ParseChannelNullable(string mention) {
return ParseMentionNullable(mention) == null ? null : await ParseChannel(mention);
}
@ -72,10 +72,6 @@ public static class Utils {
return guild.GetRole(ParseMention(mention));
}
public static IRole? ParseRoleNullable(IGuild guild, string mention) {
return ParseMentionNullable(mention) == null ? null : ParseRole(guild, mention);
}
public static async Task SendDirectMessage(IUser user, string toSend) {
try {
await user.SendMessageAsync(toSend);
@ -98,8 +94,7 @@ public static class Utils {
} catch (ArgumentException) {}
}
public static TimeSpan GetTimeSpan(string from) {
return TimeSpan.ParseExact(from.ToLowerInvariant(), Formats,
CultureInfo.InvariantCulture);
return TimeSpan.ParseExact(from.ToLowerInvariant(), Formats, CultureInfo.InvariantCulture);
}
public static string JoinString(string[] args, int startIndex) {
@ -115,4 +110,4 @@ public static class Utils {
options.AuditLogReason = reason;
return options;
}
}
}