1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Fix CI alerts

This commit is contained in:
Octol1ttle 2023-01-12 22:28:53 +05:00
parent 4b2d98c440
commit 587e5d11f9
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
6 changed files with 134 additions and 133 deletions

View file

@ -135,7 +135,7 @@ public sealed class CommandProcessor {
return null; return null;
} }
return Tuple.Create(mention, (SocketUser?)Boyfriend.Client.GetUser(mention)); return Tuple.Create(mention, Boyfriend.Client.GetUser(mention))!;
} }
public bool HasPermission(GuildPermission permission) { public bool HasPermission(GuildPermission permission) {

View file

@ -1050,7 +1050,7 @@ namespace Boyfriend {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to . /// Looks up a localized string similar to I could not find this user in any guild I&apos;m a member of! Check if the ID is correct and that the user was on this server no longer than 30 days ago (TODO).
/// </summary> /// </summary>
internal static string UserNotFound { internal static string UserNotFound {
get { get {

View file

@ -457,6 +457,6 @@
<value>Early event start notification offset</value> <value>Early event start notification offset</value>
</data> </data>
<data name="UserNotFound" xml:space="preserve"> <data name="UserNotFound" xml:space="preserve">
<value/> <value>I could not find this user in any guild I'm a member of! Check if the ID is correct and that the user was on this server no longer than 30 days ago (TODO)</value>
</data> </data>
</root> </root>

View file

@ -456,4 +456,7 @@
<data name="SettingsEventEarlyNotificationOffset" xml:space="preserve"> <data name="SettingsEventEarlyNotificationOffset" xml:space="preserve">
<value>Офсет отправки преждевременного уведомления о начале события</value> <value>Офсет отправки преждевременного уведомления о начале события</value>
</data> </data>
<data name="UserNotFound" xml:space="preserve">
<value>Я не смог найти этого пользователя ни в одном из серверов, в которых я есть. Проверь правильность ID и нахождение пользователя на этом сервере максимум 30 дней назад (TODO)</value>
</data>
</root> </root>

View file

@ -456,4 +456,7 @@
<data name="SettingsEventEarlyNotificationOffset" xml:space="preserve"> <data name="SettingsEventEarlyNotificationOffset" xml:space="preserve">
<value>заранее пнуть в минутах до начала квеста</value> <value>заранее пнуть в минутах до начала квеста</value>
</data> </data>
<data name="UserNotFound" xml:space="preserve">
<value>TODO</value>
</data>
</root> </root>

View file

@ -49,11 +49,6 @@ public static partial class Utils {
return ulong.TryParse(NumbersOnlyRegex().Replace(mention, ""), out var id) ? id : 0; return ulong.TryParse(NumbersOnlyRegex().Replace(mention, ""), out var id) ? id : 0;
} }
public static async Task SendDirectMessage(ulong id, string toSend) {
if (await Boyfriend.Client.GetUserAsync(id) is SocketUser user)
await SendDirectMessage(user, toSend);
}
public static async Task SendDirectMessage(SocketUser user, string toSend) { public static async Task SendDirectMessage(SocketUser user, string toSend) {
try { await user.SendMessageAsync(toSend); } catch (HttpException e) { try { await user.SendMessageAsync(toSend); } catch (HttpException e) {
if (e.DiscordCode is not DiscordErrorCode.CannotSendMessageToUser) throw; if (e.DiscordCode is not DiscordErrorCode.CannotSendMessageToUser) throw;