rss: make format migration actually work

This commit is contained in:
David Schultz 2023-06-16 21:47:00 -05:00
parent ababe8428a
commit 59ed31f5d9

View file

@ -20,7 +20,7 @@ class Module(ModuleManager.BaseModule):
_name = "RSS" _name = "RSS"
def _migrate_formats(self): def _migrate_formats(self):
count = 0 count = 0
migration_sub = re.compile(r"(?:\$|{)+(?P<variable>[^}\s]+)(?:})?") migration_re = re.compile(r"(?:\$|{)+(?P<variable>[^}\s]+)(?:})?")
old_formats = self.bot.database.execute_fetchall(""" old_formats = self.bot.database.execute_fetchall("""
SELECT channel_id, value FROM channel_settings SELECT channel_id, value FROM channel_settings
WHERE setting = 'rss-format' WHERE setting = 'rss-format'
@ -38,7 +38,7 @@ class Module(ModuleManager.BaseModule):
self.log.info("Successfully migrated %d rss-format settings" % count) self.log.info("Successfully migrated %d rss-format settings" % count)
def on_load(self): def on_load(self):
if self.bot.get_setting("rss-fmt-migration", False): if not self.bot.get_setting("rss-fmt-migration", False):
self.log.info("Attempting to migrate old rss-format settings") self.log.info("Attempting to migrate old rss-format settings")
self._migrate_formats() self._migrate_formats()
self.bot.set_setting("rss-fmt-migration", True) self.bot.set_setting("rss-fmt-migration", True)