Example #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));
        }
Example #2
0
 public RecentMatchesCommand(IFortNiteTrackerApi client)
     : base(client)
 {
 }
Example #3
0
 public StatsCommand(IFortNiteTrackerApi client)
     : base(client)
 {
 }
Example #4
0
 protected BaseCommand(IFortNiteTrackerApi client)
 => _client = client;