Skip to content

Commit e760b0d

Browse files
author
AbdShullah
committed
Fix enum, don't throw if can't change nickname
1 parent 9fa4247 commit e760b0d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

OsuFriendsApi/Entities/Playstyle.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using Newtonsoft.Json;
22
using Newtonsoft.Json.Converters;
3+
using System.Runtime.Serialization;
34

45
namespace OsuFriendsApi.Entities
56
{
67
[JsonConverter(typeof(StringEnumConverter))]
78
public enum Playstyle
89
{
10+
[EnumMember(Value = "touch")]
911
Touchscreen,
1012
Tablet,
1113
Mouse,

OsuFriendsBot/Services/VerificationService.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Discord;
2+
using Discord.Net;
23
using Discord.WebSocket;
34
using Microsoft.Extensions.Logging;
45
using OsuFriendsApi;
@@ -125,7 +126,14 @@ public async Task VerifyAsync(SocketGuildUser user)
125126
List<SocketRole> roles = FindUserRoles(guildRoles, osuUserDetails);
126127
await user.RemoveRolesAsync(FindAllRoles(guildRoles).Where(role => user.Roles.Contains(role) && !roles.Contains(role)));
127128
await user.AddRolesAsync(roles.Where(role => !user.Roles.Contains(role)));
128-
await user.ModifyAsync(properties => properties.Nickname = osuUserDetails.Username);
129+
try
130+
{
131+
await user.ModifyAsync(properties => properties.Nickname = osuUserDetails.Username);
132+
}
133+
catch (HttpException)
134+
{
135+
136+
}
129137

130138
embedBuilder = new EmbedBuilder();
131139
embedBuilder

0 commit comments

Comments
 (0)