mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-01 19:49:55 +03:00
Use TryGetValue instead of ContainsKey and retrieving afterwards
This commit is contained in:
parent
59d9423b5f
commit
7afd00bf30
4 changed files with 9 additions and 9 deletions
|
@ -23,8 +23,8 @@ public sealed class UnmuteCommand : ICommand {
|
|||
if (role != null && toUnmute.Roles.Contains(role)) {
|
||||
var rolesRemoved = Boyfriend.GetRemovedRoles(cmd.Context.Guild.Id);
|
||||
|
||||
if (rolesRemoved.ContainsKey(toUnmute.Id)) {
|
||||
await toUnmute.AddRolesAsync(rolesRemoved[toUnmute.Id]);
|
||||
if (rolesRemoved.TryGetValue(toUnmute.Id, out var unmutedRemovedRoles)) {
|
||||
await toUnmute.AddRolesAsync(unmutedRemovedRoles);
|
||||
rolesRemoved.Remove(toUnmute.Id);
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue