示例#1
0
        private Command(BotBitsClient client, Action<IInvokeSource, ParsedRequest> callback, MethodInfo innerMethod)
        {
            this._command = (CommandAttribute)innerMethod.GetCustomAttributes(typeof(CommandAttribute), false).FirstOrDefault();
            if (this._command == null) throw new ArgumentException("The given callback is not a command", nameof(callback));
            
            this.Names = this._command.Names ?? new string[0];
            this.Usages = this._command.Usages ?? new string[0];
            this.MinArgs = this._command.MinArgs;

            this.Callback = this._command.DoTransformations(client, this, callback);
            this._command.OnAdd(client, this);
        }