<commit_before>﻿using Discord;
using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Modix.Modules
{
    [Group("bet"), Name("Bet"), Summary("A fun betting game involving random numbers!")]
    public class BetModule : ModuleBase
    {
        private enum BettingState
        {
            Idle,
            Stage,
            Rolling,
            Results
        }

        private const int StageDurationInSeconds = 30;
        private const int StageStepLengthInSeconds = 5;
        private const int RollingDurationInSeconds = 30;
        private const int RollingStepLengthInSeconds = 5;

        private static int _stageCounter;
        private static int _rollingCounter;
        private static IUser _sessionOwner;
        private static BettingState _state;
        private static Timer _stageTimer;
        private static Timer _rollingTimer;
        private static List<IUser> _joinedUsers = new List<IUser>();
        private static Dictionary<IUser, int> _rolls = new Dictionary<IUser, int>();
        private static Random _randomGenerator = new Random();

        [Command("Stage"), Summary("Sets the stage for a new betting game. Players can join during this time with !bet join")]
        public async Task StageAsync()
        {
            if (_state != BettingState.Idle)
            {
                if (_state == BettingState.Stage && Context.User.Id != _sessionOwner.Id)
                {
                    await Context.Channel.SendMessageAsync($"MODiX is currently setting the stage for a bet. There is only `{StageDurationInSeconds - _stageCounter}` seconds left to join. `!bet join` to participate in this session");
                }
                else if (_state == BettingState.Stage && Context.User.Id == _sessionOwner.Id)
                {
                    await Context.Channel.SendMessageAsync($"You're the owner of the current session, {Context.User.Mention}. Type `!bet start` to begin the game!");
                }
                else
                {
                    await Context.Channel.SendMessageAsync("MODiX is currently in a bet. Please wait for the current game to end");
                }
            }<commit_msg>Add early return for edge case<commit_after>﻿using Discord;
using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Modix.Modules
{
    [Group("bet"), Name("Bet"), Summary("A fun betting game involving random numbers!")]
    public class BetModule : ModuleBase
    {
        private enum BettingState
        {
            Idle,
            Stage,
            Rolling,
            Results
        }

        private const int StageDurationInSeconds = 30;
        private const int StageStepLengthInSeconds = 5;
        private const int RollingDurationInSeconds = 30;
        private const int RollingStepLengthInSeconds = 5;

        private static int _stageCounter;
        private static int _rollingCounter;
        private static IUser _sessionOwner;
        private static BettingState _state;
        private static Timer _stageTimer;
        private static Timer _rollingTimer;
        private static List<IUser> _joinedUsers = new List<IUser>();
        private static Dictionary<IUser, int> _rolls = new Dictionary<IUser, int>();
        private static Random _randomGenerator = new Random();

        [Command("Stage"), Summary("Sets the stage for a new betting game. Players can join during this time with !bet join")]
        public async Task StageAsync()
        {
            if (_state != BettingState.Idle)
            {
                if (_state == BettingState.Stage && Context.User.Id != _sessionOwner.Id)
                {
                    await Context.Channel.SendMessageAsync($"MODiX is currently setting the stage for a bet. There is only `{StageDurationInSeconds - _stageCounter}` seconds left to join. `!bet join` to participate in this session");
                }
                else if (_state == BettingState.Stage && Context.User.Id == _sessionOwner.Id)
                {
                    await Context.Channel.SendMessageAsync($"You're the owner of the current session, {Context.User.Mention}. Type `!bet start` to begin the game!");
                }
                else
                {
                    await Context.Channel.SendMessageAsync("MODiX is currently in a bet. Please wait for the current game to end");
                }

                return;
            }
{'fraction_non_alphanumeric': 0.07780172413793103, 'fraction_numerical': 0.002586206896551724, 'mean_word_length': 2.2051104972375692, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '485711', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1114, 'n_words': 398}