private void AddRole(string name, string role, SocketCommandContext context, string name2 = "") { try { string parsedRole = Abbreviations.First(x => x.Value.Contains(role)).Key; var user = FindUser(name, context); if (parsedRole != "Mr. és Miss Eötvös") { var channel = FindChannel(GameRoles[parsedRole], context); channel.AddPermissionOverwriteAsync(user, new Discord.OverwritePermissions(1049600, 0)); context.Channel.SendMessageAsync(name + " jogot kapott a " + channel.Name + " szobához."); } else { Player player2 = Players.Find(p => p.Username == name2 || p.Nickname == name2); player2.AddRole(parsedRole); context.Channel.SendMessageAsync(name + " és " + name2 + " mostantól Mr. és Miss Eötvös."); } Player player = Players.Find(p => p.Username == name || p.Nickname == name); if (player == null) { player = new Player(user.Username, user.Nickname, parsedRole); Players.Add(player); } else { player.AddRole(parsedRole); } } catch (Exception ex) { if (ex.GetType() == typeof(UserNotFoundException)) { throw; } else { throw new AddRoleException("Hiba a szerep kiosztásakor. :frowning:"); } } }