fixed renaming users

This commit is contained in:
Sarah Faey 2022-12-19 16:28:03 +01:00
parent 778c262642
commit 412e707e25
2 changed files with 16 additions and 3 deletions

View file

@ -64,13 +64,22 @@ namespace DiscordBot.CommandHandlers
if(guild != null)
{
SocketGuildUser user = guild.GetUser(userId);
if(user == null)
{
await guild.DownloadUsersAsync();
user = guild.GetUser(userId);
}
if(user != null)
{
await user.ModifyAsync(p => p.Nickname = nickname);
}
}
}
catch {}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
}
}