Пример #1
0
        public GameStatusEvent(DiscordSocketClient client, ICurrencyService cs,
                               IBotConfigProvider bc, SocketGuild g, ITextChannel ch,
                               EventOptions opt,
                               Func <CurrencyEvent.Type, EventOptions, long, EmbedBuilder> embedFunc)
        {
            _log          = LogManager.GetCurrentClassLogger();
            _client       = client;
            _guild        = g;
            _cs           = cs;
            _amount       = opt.Amount;
            PotSize       = opt.PotSize;
            _embedFunc    = embedFunc;
            _isPotLimited = PotSize > 0;
            _channel      = ch;
            _bc           = bc;
            _opts         = opt;
            // generate code
            _code = new string(_sneakyGameStatusChars.Shuffle().Take(5).ToArray());

            _t = new Timer(OnTimerTick, null, Timeout.InfiniteTimeSpan, TimeSpan.FromSeconds(2));
            if (_opts.Hours > 0)
            {
                _timeout = new Timer(EventTimeout, null, TimeSpan.FromHours(_opts.Hours), Timeout.InfiniteTimeSpan);
            }
        }
Пример #2
0
        public ReactionEvent(DiscordSocketClient client, ICurrencyService cs,
                             IBotConfigProvider bc, SocketGuild g, ITextChannel ch,
                             EventOptions opt,
                             Func <Event.Type, EventOptions, long, EmbedBuilder> embedFunc)
        {
            _log                    = LogManager.GetCurrentClassLogger();
            _client                 = client;
            _guild                  = g;
            _cs                     = cs;
            _amount                 = opt.Amount;
            PotSize                 = opt.PotSize;
            _embedFunc              = embedFunc;
            _isPotLimited           = PotSize > 0;
            _channel                = ch;
            _noRecentlyJoinedServer = false;
            _bc                     = bc;
            _opts                   = opt;

            _t = new Timer(OnTimerTick, null, Timeout.InfiniteTimeSpan, TimeSpan.FromSeconds(2));
        }
Пример #3
0
        public ReactionEvent(DiscordSocketClient client, ICurrencyService cs,
                             SocketGuild g, ITextChannel ch, EventOptions opt, GamblingConfig config,
                             Func <CurrencyEvent.Type, EventOptions, long, EmbedBuilder> embedFunc)
        {
            _client                 = client;
            _guild                  = g;
            _cs                     = cs;
            _amount                 = opt.Amount;
            PotSize                 = opt.PotSize;
            _embedFunc              = embedFunc;
            _isPotLimited           = PotSize > 0;
            _channel                = ch;
            _noRecentlyJoinedServer = false;
            _opts                   = opt;
            _config                 = config;

            _t = new Timer(OnTimerTick, null, Timeout.InfiniteTimeSpan, TimeSpan.FromSeconds(2));
            if (_opts.Hours > 0)
            {
                _timeout = new Timer(EventTimeout, null, TimeSpan.FromHours(_opts.Hours), Timeout.InfiniteTimeSpan);
            }
        }