-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added reply limiter and Twitch client
- Loading branch information
Showing
11 changed files
with
436 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace RedditQuoteBot.Core.Models.Twitch | ||
{ | ||
[DebuggerDisplay("Token = {Token}, ExpiresAtLocal = {ExpiresAtLocal}")] | ||
internal class AccessTokenResponse | ||
{ | ||
[JsonPropertyName("access_token")] | ||
public string? Token { get; set; } | ||
|
||
[JsonPropertyName("refresh_token")] | ||
public string? RefreshToken { get; set; } | ||
|
||
[JsonPropertyName("token_type")] | ||
public string? Type { get; set; } | ||
|
||
private long _expiresIn; | ||
|
||
[JsonPropertyName("expires_in")] | ||
public long ExpiresIn | ||
{ | ||
get => _expiresIn; | ||
set | ||
{ | ||
_expiresIn = value; | ||
ExpiresAtUtc = DateTime.UtcNow.AddSeconds(_expiresIn); | ||
} | ||
} | ||
|
||
[JsonPropertyName("scope")] | ||
public string? Scope { get; set; } | ||
|
||
[JsonIgnore] | ||
public DateTime ExpiresAtUtc { get; private set; } = DateTime.MaxValue; | ||
|
||
[JsonIgnore] | ||
public DateTime ExpiresAtLocal { get => ExpiresAtUtc.ToLocalTime(); } | ||
|
||
public override string? ToString() => Token; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace RedditQuoteBot.Core.Models.Twitch | ||
{ | ||
[DebuggerDisplay("UserLogin = {UserLogin}, Title = {Title}, ViewerCount = {ViewerCount}")] | ||
internal class StreamData | ||
{ | ||
[JsonPropertyName("id")] | ||
public string? Id { get; set; } | ||
|
||
[JsonPropertyName("user_id")] | ||
public string? UserId { get; set; } | ||
|
||
[JsonPropertyName("user_login")] | ||
public string? UserLogin { get; set; } | ||
|
||
[JsonPropertyName("game_id")] | ||
public string? GameId { get; set; } | ||
|
||
[JsonPropertyName("game_name")] | ||
public string? GameName { get; set; } | ||
|
||
[JsonPropertyName("type")] | ||
public string? Type { get; set; } | ||
|
||
[JsonPropertyName("title")] | ||
public string? Title { get; set; } | ||
|
||
[JsonPropertyName("viewer_count")] | ||
public int ViewerCount { get; set; } | ||
|
||
[JsonPropertyName("started_at")] | ||
public DateTime StartedAt { get; set; } | ||
|
||
[JsonPropertyName("language")] | ||
public string? Language { get; set; } | ||
|
||
[JsonPropertyName("thumbnail_url")] | ||
public string? ThumbnailUrl { get; set; } | ||
|
||
[JsonPropertyName("is_mature")] | ||
public bool IsMature { get; set; } | ||
|
||
[JsonPropertyName("tag_ids")] | ||
public IList<string?>? TagIds { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace RedditQuoteBot.Core.Models.Twitch | ||
{ | ||
internal class StreamsResponse | ||
{ | ||
[JsonPropertyName("data")] | ||
public IList<StreamData>? Data { get; set; } | ||
} | ||
} |
Oops, something went wrong.