@@ -71,27 +71,27 @@ async def platformChecker(isOnlineFunc: Callable,platformNotifFunc: Callable, us
7171 isOnline = isOnline if db .getRerunAnnounce () else False
7272 isRerun = True
7373 logger .debug (platformName + " +Offline|-Online: " + str ((- 1 * secondsSinceStreamStartTime ) if isOnline else secondsSinceStreamEndTime ))
74- if isOnline == True :
74+ if isOnline :
7575 db .setRerun (isRerun , platformName )
7676 if secondsSinceStreamEndTime >= baseSettings .WAIT_BETWEEN_MESSAGES and secondsSinceLastMessage >= baseSettings .WAIT_BETWEEN_MESSAGES and streamEndTime >= streamStartTime :
7777 logger .info (f"{ platformName } : Sending Notification" )
7878 await platformNotifFunc (rest , title , thumbUrl , icon , userName , isRerun )
79- db .updatePlatformRowCol (platformName , "last_stream_start_time" ,time .time ())
80- db .updatePlatformAccountRowCol (platformName , userName , "last_stream_start_time" ,time .time ())
79+ db .SetPlatformLastStreamStartTime (platformName ,time .time ())
80+ db .SetPlatformAccountLastStreamStartTime (platformName , userName ,time .time ())
8181 globals .rebroadcast [platformName ] = 0
8282 elif secondsSinceLastMessage >= baseSettings .ONLINE_MESSAGE_REBROADCAST_TIME or globals .rebroadcast [platformName ]:
8383 logger .info (f"{ platformName } : Rebroadcast Command or Rebroadcast_TIME Notification sent" )
8484 await platformNotifFunc (rest , title , thumbUrl , icon , userName , isRerun )
8585 lastOnlineMessage = time .time ()
8686 globals .rebroadcast [platformName ] = 0
8787 elif streamEndTime >= streamStartTime :
88- db .updatePlatformRowCol (platformName , "last_stream_start_time" ,time .time ())
89- db .updatePlatformAccountRowCol (platformName ,userName , "last_stream_start_time" ,time .time ())
90- elif isOnline == False :
88+ db .SetPlatformLastStreamStartTime (platformName ,time .time ())
89+ db .SetPlatformAccountLastStreamStartTime (platformName ,userName ,time .time ())
90+ elif not isOnline :
9191 db .setRerun (isRerun , platformName )
9292 if streamEndTime <= streamStartTime :
93- db .updatePlatformRowCol (platformName , "last_stream_end_time" ,time .time ())
94- db .updatePlatformAccountRowCol (platformName ,userName , "last_stream_end_time" ,time .time ())
93+ db .SetPlatformLastStreamEndTime (platformName ,time .time ())
94+ db .SetPlatformAccountLastStreamEndTime (platformName ,userName ,time .time ())
9595 globals .rebroadcast [platformName ] = 0
9696
9797@component .with_schedule
@@ -277,7 +277,7 @@ async def presenceGrabber(rest: alluka.Injected[hikari.impl.RESTClientImpl]) ->
277277 async for member in members :
278278 memberCount += 1
279279 presence = member .get_presence ()
280- if presence != None :
280+ if presence is not None :
281281 status = presence .visible_status
282282 statusStr = str (status )
283283 if statusStr in statusCounts :
@@ -359,7 +359,8 @@ async def resetUnreviewedAppeals(rest: alluka.Injected[hikari.impl.RESTClientImp
359359@component .with_schedule
360360@tanjun .as_interval (30 , max_runs = 1 )
361361async def startWebhookServer (rest : alluka .Injected [hikari .impl .RESTClientImpl ]) -> None :
362- if not baseSettings .webhookPort or not baseSettings .webhookHostIp : return
362+ if not baseSettings .webhookPort or not baseSettings .webhookHostIp :
363+ return
363364 Kick .DeleteAllWebhooks () # Kick stops sending webhooks to a server that hasn't responded (down or restart). Deleting and resubbing fixes that
364365 app .state .restClient = rest
365366 await checkKick (rest )
@@ -402,7 +403,7 @@ async def OAuthCallback(code: str = None, state: str = None, error: str = None):
402403 status_code = 401 ,
403404 detail = f"Authorization failed. Error: { error } "
404405 )
405- if not state or not state in globals .kickOauth :
406+ if not state or state not in globals .kickOauth :
406407 logger .debug ("oauth state didn't match" )
407408 raise HTTPException (
408409 status_code = 403 ,
@@ -446,7 +447,8 @@ async def OAuthCallback(code: str = None, state: str = None, error: str = None):
446447 return RedirectResponse (url = baseSettings .kickDiscordRedirect )
447448
448449async def processWebhookData (body , headers ):
449- if 'kick-event-type' not in headers or headers == globals .kickLastWebhookHeaders : return
450+ if 'kick-event-type' not in headers or headers == globals .kickLastWebhookHeaders :
451+ return
450452 globals .kickLastWebhookHeaders = headers
451453 if Kick .verifyWebhook (headers , body ):
452454 logger .debug ("verified kick webhook" )
@@ -486,7 +488,8 @@ async def memberLogger(rest: alluka.Injected[hikari.impl.RESTClientImpl]) -> Non
486488@component .with_schedule
487489@tanjun .as_interval (30 , max_runs = 1 )
488490async def startKickWebsocket (rest : alluka .Injected [hikari .impl .RESTClientImpl ]) -> None :
489- if not baseSettings .kickChatroomId or not baseSettings .kickChannelId : return
491+ if not baseSettings .kickChatroomId or not baseSettings .kickChannelId :
492+ return
490493 lastLaunchTime = time .time ()
491494 maxRetries = 3
492495 maxRetryWindow = 30
@@ -505,7 +508,8 @@ async def startKickWebsocket(rest: alluka.Injected[hikari.impl.RESTClientImpl])
505508@component .with_schedule
506509@tanjun .as_interval (baseSettings .ROLE_ADD_REMOVE_TIMER )
507510async def AddKickRoles (rest : alluka .Injected [hikari .impl .RESTClientImpl ]) -> None :
508- if not baseSettings .hasRolePermissions : return
511+ if not baseSettings .hasRolePermissions :
512+ return
509513 db = Database ()
510514 subsShortThreshold = baseSettings .kickSubsShortThreshold
511515 subsShortLookBackHours = baseSettings .kickSubsShortLookBackHours
@@ -566,7 +570,8 @@ async def HandleLongSubRoles(rest:hikari.impl.RESTClientImpl, db:Database, longS
566570@component .with_schedule
567571@tanjun .as_interval (baseSettings .ROLE_ADD_REMOVE_TIMER )
568572async def RemoveKickRoles (rest : alluka .Injected [hikari .impl .RESTClientImpl ]) -> None :
569- if not baseSettings .hasRolePermissions :return
573+ if not baseSettings .hasRolePermissions :
574+ return
570575 db = Database ()
571576 longDateRolePeriod = baseSettings .kickLongDateRolePeriod
572577 shortTimeRolePeriod = baseSettings .kickShortTimeRolePeriod
0 commit comments