示例#1
0
        public CommandHandler(TelegramBotClient bot, string trnApiKey)
        {
            var ftCommandType = typeof(IFortniteCommand);
            var commandTypes  = typeof(CommandHandler).Assembly.GetTypes()
                                .Where(t => ftCommandType.IsAssignableFrom(t))
                                .Where(t => t.IsClass && !t.IsAbstract)
                                .ToArray();

            _bot    = bot;
            _client = RestService.For <IFortNiteTrackerApi>(new HttpClient(new AuthenticatedHttpClientHandler(trnApiKey))
            {
                BaseAddress = new Uri("https://api.fortnitetracker.com")
            });
            _commands = commandTypes.ToDictionary(t => t.Name.Replace("Command", "").ToLower(), t => CreateCommandInstance(t));
        }
示例#2
0
 public RecentMatchesCommand(IFortNiteTrackerApi client)
     : base(client)
 {
 }
示例#3
0
 public StatsCommand(IFortNiteTrackerApi client)
     : base(client)
 {
 }
示例#4
0
 protected BaseCommand(IFortNiteTrackerApi client)
 => _client = client;