mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-06 14:06:29 +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
|
@ -26,8 +26,8 @@ public sealed class MuteCommand : ICommand {
|
|||
|
||||
var rolesRemoved = Boyfriend.GetRemovedRoles(cmd.Context.Guild.Id);
|
||||
|
||||
if (rolesRemoved.ContainsKey(toMute.Id)) {
|
||||
foreach (var roleId in rolesRemoved[toMute.Id]) await toMute.AddRoleAsync(roleId);
|
||||
if (rolesRemoved.TryGetValue(toMute.Id, out var mutedRemovedRoles)) {
|
||||
foreach (var roleId in mutedRemovedRoles) await toMute.AddRoleAsync(roleId);
|
||||
rolesRemoved.Remove(toMute.Id);
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
cmd.Reply(Messages.RolesReturned, ":warning: ");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue