mirror of
https://github.com/GaMeNu/HFCNotificator.git
synced 2024-11-16 15:24:51 +02:00
v2.1.2
Changed time formatting for embed Better fix for update loop crashing?
This commit is contained in:
parent
8e2fd34353
commit
2ff5f5a777
@ -109,10 +109,13 @@ class Notificator(commands.Cog):
|
|||||||
self.log.debug(f'Alert response: {current_alert}')
|
self.log.debug(f'Alert response: {current_alert}')
|
||||||
|
|
||||||
if current_alert is None:
|
if current_alert is None:
|
||||||
|
|
||||||
if len(self.active_districts) == 0:
|
if len(self.active_districts) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.reset_district_checker += 1
|
self.reset_district_checker += 1
|
||||||
if self.reset_district_checker == 3:
|
if self.reset_district_checker == 3:
|
||||||
|
print('reset')
|
||||||
self.active_districts = []
|
self.active_districts = []
|
||||||
self.reset_district_checker = 0
|
self.reset_district_checker = 0
|
||||||
return
|
return
|
||||||
@ -136,8 +139,11 @@ class Notificator(commands.Cog):
|
|||||||
self.log.error(f'Could not send message!\nError info: {e.__str__()}')
|
self.log.error(f'Could not send message!\nError info: {e.__str__()}')
|
||||||
self.active_districts = data
|
self.active_districts = data
|
||||||
|
|
||||||
@check_for_updates.error
|
@check_for_updates.after_loop
|
||||||
async def update_loop_error(self):
|
async def update_loop_error(self):
|
||||||
|
# Attempt to force stupid "Unread Result" down its own throat
|
||||||
|
# and just reset the connection.
|
||||||
|
# I'm not dealing with Unread Results
|
||||||
self.db.connection.close()
|
self.db.connection.close()
|
||||||
self.db = DBAccess()
|
self.db = DBAccess()
|
||||||
if not self.check_for_updates.is_running():
|
if not self.check_for_updates.is_running():
|
||||||
@ -206,7 +212,7 @@ class Notificator(commands.Cog):
|
|||||||
# it's not within 5 minutes, keep looking.
|
# it's not within 5 minutes, keep looking.
|
||||||
# DF Code ruined me, and now I overuse break and continue.
|
# DF Code ruined me, and now I overuse break and continue.
|
||||||
|
|
||||||
alert_time_str = alert_time.strftime("%Y-%m-%d %H:%M:%S")
|
alert_time_str = alert_time.strftime("%H:%M:%S %d/%m/%Y")
|
||||||
if district_data is not None:
|
if district_data is not None:
|
||||||
embed_ls.append(Notificator.generate_alert_embed(new_alert, district, district_data.migun_time,
|
embed_ls.append(Notificator.generate_alert_embed(new_alert, district, district_data.migun_time,
|
||||||
alert_time_str, 'he'))
|
alert_time_str, 'he'))
|
||||||
|
@ -45,6 +45,7 @@ class ChannelIterator:
|
|||||||
def __next__(self) -> Channel:
|
def __next__(self) -> Channel:
|
||||||
res = self.cursor.fetchone()
|
res = self.cursor.fetchone()
|
||||||
if res is None:
|
if res is None:
|
||||||
|
self.cursor.close()
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
return Channel(res[0], res[1], res[2])
|
return Channel(res[0], res[1], res[2])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user