Skip to content

Commit

Permalink
Seems to be working
Browse files Browse the repository at this point in the history
  • Loading branch information
pulcher committed Jul 9, 2024
1 parent 5c97497 commit 2ecaa5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Magic8HeadService/Commands/DadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public void Handle(OnChatCommandReceivedArgs cmd)

sayingResponse.SaySomethingNiceAsync(dadJoke, client, cmd.Command.ChatMessage.Channel, cmd.Command.ChatMessage.Username);
client.SendMessage(cmd.Command.ChatMessage.Channel, $"Q: {dadJoke}");

coolDownService.Execute(AvailableCommands.Dad);
}
else
{
Expand All @@ -50,7 +52,7 @@ public void Handle(OnChatCommandReceivedArgs cmd)
public bool CanExecute()
{
var currentTime = DateTime.UtcNow;
var currentCoolDown = coolDownService.GetCurrentCoolDown("dad");
var currentCoolDown = coolDownService.GetCurrentCoolDown(AvailableCommands.Dad);

if (currentTime < currentCoolDown)
{
Expand Down
7 changes: 4 additions & 3 deletions Magic8HeadService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
configuration.GetSection("TwitchBotConfiguration").Bind(twitchBotConfiguration);
services.AddSingleton(twitchBotConfiguration);

var coolDownOptions = new CoolDownOptions();
configuration.GetSection("CoolDownOptions").Bind(coolDownOptions);
services.AddSingleton(coolDownOptions);
//var coolDownOptions = new CoolDownOptions();
//configuration.GetSection("CoolDownOptions").Bind(coolDownOptions);
//services.AddSingleton(coolDownOptions);

services.Configure<CoolDownOptions>(configuration.GetSection("CoolDownOptions"));

var credentials = new ConnectionCredentials(twitchBotConfiguration.UserName, twitchBotConfiguration.AccessToken);
services.AddSingleton(credentials);
Expand Down
3 changes: 2 additions & 1 deletion Magic8HeadService/Services/CoolDownOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;

namespace Magic8HeadService.Services
Expand Down

0 comments on commit 2ecaa5f

Please sign in to comment.