Skip to content

Commit

Permalink
Updated twitchchatconfig to have a default (#229)
Browse files Browse the repository at this point in the history
* Updated twitchchatconfig to have a default

* Applying formatting changes through GitHub Actions

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
csharpfritz and github-actions[bot] committed Oct 8, 2023
1 parent e298f88 commit 1666215
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/TagzApp.Providers.TwitchChat/StartTwitchChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ protected override void MapConfigurationValues(ProviderConfiguration providerCon
{
var config = providerConfiguration.ConfigurationSettings;

if (config != null)
if (config is null)
{
_TwitchChatConfiguration = new TwitchChatConfiguration
{
ClientId = config["ClientId"] ?? string.Empty,
ClientSecret = config["ClientSecret"] ?? string.Empty,
ChatBotName = config["ChatBotName"] ?? string.Empty,
OAuthToken = config["OAuthToken"] ?? string.Empty,
ChannelName = config["ChannelName"] ?? string.Empty
};
_TwitchChatConfiguration = TwitchChatConfiguration.Empty;
return;
}

_TwitchChatConfiguration = new TwitchChatConfiguration
{
ClientId = config.GetValueOrDefault("ClientId", string.Empty),
ClientSecret = config.GetValueOrDefault("ClientSecret", string.Empty),
ChatBotName = config.GetValueOrDefault("ChatBotName", string.Empty),
OAuthToken = config.GetValueOrDefault("OAuthToken", string.Empty),
ChannelName = config.GetValueOrDefault("ChannelName", string.Empty)
};

}
}
10 changes: 10 additions & 0 deletions src/TagzApp.Providers.TwitchChat/TwitchChatConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ public class TwitchChatConfiguration
public required string ChatBotName { get; set; }
public required string OAuthToken { get; set; }
public required string ChannelName { get; set; } = "csharpfritz";

public static TwitchChatConfiguration Empty => new()
{
ClientId = string.Empty,
ClientSecret = string.Empty,
ChatBotName = string.Empty,
OAuthToken = string.Empty,
ChannelName = string.Empty
};

}
4 changes: 2 additions & 2 deletions src/TagzApp.Web/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ span.invisible {
width: 50%;
text-align: center;
font-size: 4em;
color: #777;
color: #333;
}

#moderationAction i:hover {
color: #333;
color: firebrick;
cursor: pointer;
}

Expand Down

0 comments on commit 1666215

Please sign in to comment.