mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Put in a hacked up feature to disable Kick Pusher as the API is having massive issues (again)
This commit is contained in:
@@ -37,6 +37,7 @@ public class KickBot
|
||||
private BotCommands _botCommands;
|
||||
private string _bmjTwitchUsername;
|
||||
private Howlgg _howlgg;
|
||||
private bool _kickDisabled = true;
|
||||
|
||||
public KickBot()
|
||||
{
|
||||
@@ -46,7 +47,7 @@ public class KickBot
|
||||
BuiltIn.Keys.KiwiFarmsWsEndpoint, BuiltIn.Keys.KiwiFarmsDomain, BuiltIn.Keys.PusherEndpoint,
|
||||
BuiltIn.Keys.Proxy, BuiltIn.Keys.PusherReconnectTimeout, BuiltIn.Keys.PusherChannels,
|
||||
BuiltIn.Keys.TwitchBossmanJackId, BuiltIn.Keys.DiscordToken, BuiltIn.Keys.KiwiFarmsWsReconnectTimeout,
|
||||
BuiltIn.Keys.KiwiFarmsToken
|
||||
BuiltIn.Keys.KiwiFarmsToken, BuiltIn.Keys.KickEnabled
|
||||
]).Result;
|
||||
|
||||
_xfSessionToken = settings[BuiltIn.Keys.KiwiFarmsToken].Value ?? "unset";
|
||||
@@ -85,11 +86,16 @@ public class KickBot
|
||||
|
||||
KfClient.StartWsClient().Wait(_cancellationToken);
|
||||
|
||||
_kickClient.StartWsClient().Wait(_cancellationToken);
|
||||
var pusherChannels = settings[BuiltIn.Keys.PusherChannels].Value ?? "";
|
||||
foreach (var channel in pusherChannels.Split(','))
|
||||
if (settings[BuiltIn.Keys.KickEnabled].ToBoolean())
|
||||
{
|
||||
_kickClient.SendPusherSubscribe(channel);
|
||||
_kickClient.StartWsClient().Wait(_cancellationToken);
|
||||
var pusherChannels = settings[BuiltIn.Keys.PusherChannels].Value ?? "";
|
||||
foreach (var channel in pusherChannels.Split(','))
|
||||
{
|
||||
_kickClient.SendPusherSubscribe(channel);
|
||||
}
|
||||
|
||||
_kickDisabled = false;
|
||||
}
|
||||
|
||||
_logger.Debug("Creating ping thread and starting it");
|
||||
@@ -308,7 +314,10 @@ public class KickBot
|
||||
Thread.Sleep(TimeSpan.FromSeconds(15));
|
||||
_logger.Debug("Pinging KF");
|
||||
KfClient.SendMessage("/ping");
|
||||
_kickClient.SendPusherPing();
|
||||
if (!_kickDisabled)
|
||||
{
|
||||
_kickClient.SendPusherPing();
|
||||
}
|
||||
if (_initialStartCooldown) _initialStartCooldown = false;
|
||||
var inactivityTime = DateTime.Now - _lastKfEvent;
|
||||
_logger.Debug($"Last KF event was {inactivityTime:g} ago");
|
||||
|
||||
@@ -312,6 +312,14 @@ public static class BuiltIn
|
||||
Description = "Last successfully retrieved forum token (will be refreshed automatically if expired)",
|
||||
Default = null,
|
||||
IsSecret = true
|
||||
},
|
||||
new BuiltInSettingsModel
|
||||
{
|
||||
Key = Keys.KickEnabled,
|
||||
Regex = "true|false",
|
||||
Description = "Whether to enable Kick functionality (Pusher websocket mainly)",
|
||||
Default = "true",
|
||||
IsSecret = false
|
||||
}
|
||||
];
|
||||
|
||||
@@ -342,5 +350,6 @@ public static class BuiltIn
|
||||
public static string JuiceCooldown = "Juice.Cooldown";
|
||||
public static string JuiceAmount = "Juice.Amount";
|
||||
public static string KiwiFarmsToken = "KiwiFarms.Token";
|
||||
public static string KickEnabled = "Kick.Enabled";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user