added try catch to avoid discord error message if renaming user is not possible

This commit is contained in:
Sarah Faey 2022-12-01 21:50:58 +01:00
parent 26dd595057
commit 104b938afc

View file

@ -57,6 +57,8 @@ namespace DiscordBot.CommandHandlers
{ {
string nickname = $"{name} | {account}"; string nickname = $"{name} | {account}";
foreach(ulong serverId in serverList) foreach(ulong serverId in serverList)
{
try
{ {
SocketGuild guild = client.Guilds.FirstOrDefault(g => g.Id == serverId); SocketGuild guild = client.Guilds.FirstOrDefault(g => g.Id == serverId);
if(guild != null) if(guild != null)
@ -68,6 +70,8 @@ namespace DiscordBot.CommandHandlers
} }
} }
} }
catch {}
}
} }
public async Task SelectRole(SocketInteraction component, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp, ulong signedUpByUserId) public async Task SelectRole(SocketInteraction component, int raidId, string buttonType, bool allRoles, ulong userIdToSignUp, ulong signedUpByUserId)