public async Task Spectate(CommandContext ctx) { if (ctx.Guild.Id != 572662006692315136) { await ctx.RespondAsync("Command is not usable within this guild"); return; } if (MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.Queueing && MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.GameSetup) { await ctx.RespondAsync("You cannot join spectators when a game has already started"); return; } if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.Idle) { await ctx.RespondAsync("There is no queue to spectate."); return; } if (!(await MatchmakingModule.DoesPlayerHaveSteamIDRegistered(ctx, ctx.Member))) { await ctx.RespondAsync("You must have your Steam ID registered to spectate! Use `>register [id]` to add your Steam ID. (NEEDS to be a SteamID64. Find your Steam ID here: https://steamidfinder.com/)"); return; } MatchmakingModule.CurrentSpectatorDiscordIds.Add(ctx.Member.Id.ToString()); MatchmakingModule.CurrentSpectatorIds.Add(ctx.Member.Id.ToString()); MatchmakingModule.CurrentSpectatorNames.Add(ctx.Member.DisplayName); await ctx.RespondAsync("You have been added to the list of spectators when the game starts"); }
public async Task Play(CommandContext ctx, string extra = "") { if (ctx.Guild.Id != 572662006692315136) { await ctx.RespondAsync("Command is not usable within this guild"); return; } if (!(await MatchmakingModule.DoesPlayerHaveSteamIDRegistered(ctx, ctx.Member))) { await ctx.RespondAsync("You must have your Steam ID registered to play! Use `>register id` to add your Steam ID. (NEEDS to be a SteamID64. Find your Steam ID here: https://steamidfinder.com/)"); return; } if (MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.Idle) { if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.GameInProgress || MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.GameSetup) { await ctx.RespondAsync("A match is currently being played, please wait until the match concludes."); } else if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.Queueing) { await ctx.RespondAsync("A queue already exists. Use `>queue` to join the game."); } else if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.DisplayingResults) { await ctx.RespondAsync("The results for the previous game are being calculated. Please wait for it to finish before starting a new queue."); } return; } MatchmakingModule.CurrentGameState = MatchmakingModule.MatchmakingState.Queueing; MatchmakingModule.PlayersInQueue.Clear(); MatchmakingModule.CaptainPick = extra.ToLower() == "pick"; await MatchmakingModule.ChangeNameIfRelevant(ctx.Member); await MatchmakingModule.JoinQueue(ctx, ctx.Member); new Task(async() => { await MatchmakingModule.TimeOut(ctx); }).Start(); }
public async Task Queue(CommandContext ctx) { if (ctx.Guild.Id != 572662006692315136) { await ctx.RespondAsync("Command is not usable within this guild"); return; } if (!(await MatchmakingModule.DoesPlayerHaveSteamIDRegistered(ctx, ctx.Member))) { await ctx.RespondAsync("You must have your Steam ID registered to play! Use `>register [id]` to add your Steam ID. (NEEDS to be a SteamID64. Find your Steam ID here: https://steamidfinder.com/)"); return; } if (MatchmakingModule.CurrentGameState == MatchmakingModule.MatchmakingState.Idle) { await ctx.RespondAsync("There is no existing queue to join. Use `>startqueue` to start your own queue."); return; } else if (MatchmakingModule.CurrentGameState != MatchmakingModule.MatchmakingState.Queueing) { await ctx.RespondAsync("A game is already being played, you cannot join this queue."); return; } if (MatchmakingModule.Bets.ContainsKey(ctx.Member.Id.ToString())) { await ctx.RespondAsync("Your bet of " + MatchmakingModule.Bets[ctx.Member.Id.ToString()] + " SquidCoin has been removed."); MatchmakingModule.Bets.Remove(ctx.Member.Id.ToString()); } await MatchmakingModule.ChangeNameIfRelevant(ctx.Member); await MatchmakingModule.JoinQueue(ctx, ctx.Member); }