Beispiel #1
0
        /// <inheritdoc/>
        public void Post(DiscordCommandContext context, CommandQueueDelegate func)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            Bucket kamaji;

            if (context.GuildId == null)
            {
                lock (this)
                {
                    kamaji = _privateBucket ??= new Bucket(Logger, DegreeOfParallelism);
                }
            }
            else
            {
                kamaji = _guildBuckets.GetOrAdd(context.GuildId.Value, (_, queue) => new Bucket(queue.Logger, queue.DegreeOfParallelism), this);
            }

            var bathToken = new Token(context, func);

            kamaji.Post(bathToken); // Thank you, mr boiler man!
        }
 public Token(string input, DiscordCommandContext context, CommandQueueDelegate func)
 {
     _input  = input;
     Context = context;
     _func   = func;
 }
Beispiel #3
0
 public Token(DiscordCommandContext context, CommandQueueDelegate func)
 {
     Context = context;
     _func   = func;
 }