mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-03 04:29:54 +03:00
Fix more bugs and problems
This commit is contained in:
parent
f1bd54d6f6
commit
7059c7576d
8 changed files with 46 additions and 19 deletions
|
@ -96,7 +96,7 @@ public static partial class Utils {
|
|||
if (sendPublic && systemChannel is not null) await SilentSendAsync(systemChannel, toSend);
|
||||
}
|
||||
|
||||
public static string GetHumanizedTimeOffset(TimeSpan span) {
|
||||
public static string GetHumanizedTimeSpan(TimeSpan span) {
|
||||
return span.TotalSeconds < 1
|
||||
? Messages.Ever
|
||||
: $" {span.Humanize(2, minUnit: TimeUnit.Second, maxUnit: TimeUnit.Month, culture: Messages.Culture.Name.Contains("RU") ? CultureInfoCache["ru"] : Messages.Culture)}";
|
||||
|
@ -145,7 +145,8 @@ public static partial class Utils {
|
|||
|
||||
if (role is not null) {
|
||||
if (!toUnmute.Roles.Contains(role)) return false;
|
||||
await toUnmute.AddRolesAsync(data.MemberData[toUnmute.Id].Roles, requestOptions);
|
||||
if (data.Preferences["RemoveRolesOnMute"] is "true")
|
||||
await toUnmute.AddRolesAsync(data.MemberData[toUnmute.Id].Roles, requestOptions);
|
||||
await toUnmute.RemoveRoleAsync(role, requestOptions);
|
||||
data.MemberData[toUnmute.Id].MutedUntil = null;
|
||||
} else {
|
||||
|
@ -157,6 +158,13 @@ public static partial class Utils {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static async Task ReturnRolesAsync(SocketGuildUser user, List<ulong> roles) {
|
||||
// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
|
||||
foreach (var role in roles)
|
||||
if (role != user.Guild.Id)
|
||||
await user.AddRoleAsync(role);
|
||||
}
|
||||
|
||||
[GeneratedRegex("[^0-9]")]
|
||||
private static partial Regex NumbersOnlyRegex();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue