Пример #1
0
 public async Task CancelGame(IUser user, bool forceClose = false)
 {
     if (Status > GameStatus.Cancelled && (user.Id == Hoster?.Id || forceClose))
     {
         if (Status < GameStatus.GaiaEnding)
         {
             await(await ServerHost.GetTextChannelsAsync()).First((x) => x.Name == "public_gvg").SendMessageAsync("The game has been cancelled by the host.");
         }
         Status = GameStatus.Cancelled;
         foreach (var mem in GaiaMembers.Concat(GuardianMembers).Concat(OCMembers).Concat(Civilians))
         {
             try
             {
                 await mem.RemoveRolesAsync(new IRole[] { GvG_Player, GvG_Dead_Player });
             } catch (Exception)
             {
                 // do nothing
             }
         }
         GaiaMembers.Clear();
         GuardianMembers.Clear();
         OCMembers.Clear();
         Civilians.Clear();
         PhaseTimer?.Change(Timeout.Infinite, Timeout.Infinite);
     }
 }