コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LastFmService"/> class.
 /// </summary>
 /// <param name="httpClient">The http client.</param>
 /// <param name="options">The scrobblebot configurations options.</param>
 public LastFmService(HttpClient httpClient, IOptions <ScrobbleBotConfiguration> options)
 {
     _httpClient = httpClient;
     _scrobbleBotConfiguration = options.Value;
     _jsonSerializerOptions    = new JsonSerializerOptions()
     {
         PropertyNameCaseInsensitive = true
     };
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscordStartupService"/> class.
 /// </summary>
 /// <param name="options">The scrobble bot configuration options.</param>
 /// <param name="discordSocketClient">The discord socket client.</param>
 /// <param name="commandService">The command service.</param>
 /// <param name="serviceProvider">The service provider.</param>
 public DiscordStartupService(
     IOptions <ScrobbleBotConfiguration> options,
     DiscordSocketClient discordSocketClient,
     CommandService commandService,
     IServiceProvider serviceProvider)
 {
     _discordSocketClient      = discordSocketClient;
     _commandService           = commandService;
     _serviceProvider          = serviceProvider;
     _scrobbleBotConfiguration = options.Value;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandHandler"/> class.
 /// </summary>
 /// <param name="discordSocketClient">The discord socket client.</param>
 /// <param name="commandService">The command service.</param>
 /// <param name="scrobbleBotConfigurationOptions">The scrobble bot configuration options.</param>
 /// <param name="serviceProvider">The service provider.</param>
 public CommandHandler(
     DiscordSocketClient discordSocketClient,
     CommandService commandService,
     IOptions <ScrobbleBotConfiguration> scrobbleBotConfigurationOptions,
     IServiceProvider serviceProvider)
 {
     _discordSocketClient                  = discordSocketClient;
     _commandService                       = commandService;
     _scrobbleBotConfiguration             = scrobbleBotConfigurationOptions.Value;
     _serviceProvider                      = serviceProvider;
     _discordSocketClient.MessageReceived += OnMessageReceivedAsync;
 }