public async Task CheckForEnd() { if (Impeachment != null) { if (Impeachment.TargetIndicted) { if (Impeachment.TargetRemoved) { await Impeachment.SentMessage.Channel.SendMessageAsync($"{Impeachment.Target.Name} has been impeached and removed!"); foreach (var div in Impeachment.RemovingFrom) { div.Employees.RemoveAll(x => x.Id == Impeachment.Target.User.Id); if (div.DivisionHead.Id == Impeachment.Target.User.Id) { if (div.Employees.Count > 0) { div.DivisionHead = div.Employees.FirstOrDefault(); await div.DivisionHead.AddRoleAsync(div.DivisionHeadRole); await div.DivisionStaffChannel.SendMessageAsync($"Division Head was impeached and {div.DivisionHead.Username} has been promoted"); } else { div.DivisionHead = FourAcesCasino.GetMember("Four Aces Casino").User; await div.DivisionStaffChannel.SendMessageAsync($"Division Head was impeached\r\nDivision currently has no employees at all."); } } else { await div.DivisionStaffChannel.SendMessageAsync($"{Impeachment.Target.Name} was impeached for {Impeachment.Reason}\r\nThey ***must not*** be re-hired"); } } await Program.C_LOGS_FAC_DIVISION.SendMessageAsync("Logging impeachment vote that passed successfully", false, Impeachment.ToEmbed()); Impeachment = null; FourAcesCasino.Save(); } } } }
protected override void AfterExecute(CommandInfo command) { FourAcesCasino.Save(); bool hasAnyOfTheToggleAble = false; SocketGuildUser g = (SocketGuildUser)Context.User; foreach (var role in new IRole[] { Marvel, Tester, Developer, Sports }) { if (g.Roles.Contains(role)) { hasAnyOfTheToggleAble = true; break; } } if (hasAnyOfTheToggleAble) { g.AddRoleAsync(Seperator); } else { g.RemoveRoleAsync(Seperator); } }