Esempio n. 1
0
        public async Task RandomImage(ulong channel, RandomStatus state)
        {
            if (state == RandomStatus.Off)
            {
                return;
            }

            var frequency = RandomFrequency.GetOrAdd(channel, 720 * 4);

            if (random.Next((int)frequency) != 1)
            {
                return;
            }

            var spoiler = false;

            if (state == RandomStatus.Safe)
            {
                var now = DateTime.UtcNow;
                if (now.Hour > 15 || now.Hour < 1)
                {
                    spoiler = true;
                }
            }

            await RandomImage(channel, spoiler);
        }
Esempio n. 2
0
 protected override void BeforeExecute(CommandInfo command)
 {
     base.BeforeExecute(command);
     State     = Randomize.GetOrAdd(Context.Channel.Id, RandomStatus.Off);
     Frequency = RandomFrequency.GetOrAdd(Context.Channel.Id, 720 * 4);
 }