forked from Hay1tsme/artemis
feat(chuni.read): Only enable announcement events of the latest imported option
This commit is contained in:
@ -117,6 +117,11 @@ class ChuniReader(BaseReader):
|
||||
)
|
||||
|
||||
async def read_events(self, evt_dir: str) -> None:
|
||||
# Disable all previous announcement events
|
||||
# All new announcement events will be enabled, so we don't end up with banner spam
|
||||
# every time we card in.
|
||||
await self.data.static.disable_all_events(self.version, 1)
|
||||
|
||||
for root, dirs, files in walk(evt_dir):
|
||||
for dir in dirs:
|
||||
if path.exists(f"{root}/{dir}/Event.xml"):
|
||||
|
@ -339,6 +339,10 @@ class ChuniStaticData(BaseData):
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchall()
|
||||
|
||||
async def disable_all_events(self, version: int, type: int):
|
||||
sql = events.update().where((events.c.version == version) & (events.c.type == type))
|
||||
await self.execute(sql)
|
||||
|
||||
async def put_music(
|
||||
self,
|
||||
@ -593,4 +597,4 @@ class ChuniStaticData(BaseData):
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchone()
|
||||
return result.fetchone()
|
||||
|
Reference in New Issue
Block a user