Save RSS state on exit
This commit is contained in:
parent
333d2cdb76
commit
46fdcc85a0
3
bot.py
3
bot.py
|
@ -1,4 +1,4 @@
|
||||||
import teambot,tasks,rss,time,sys,subprocess,re,plugin,impmod,traceback,os
|
import teambot,tasks,rss,time,sys,subprocess,re,plugin,impmod,traceback,os,atexit
|
||||||
|
|
||||||
feed_url = "https://cosmic.voyage/rss.xml"
|
feed_url = "https://cosmic.voyage/rss.xml"
|
||||||
bot_op = "khuxkm@sudoers.tilde.team"
|
bot_op = "khuxkm@sudoers.tilde.team"
|
||||||
|
@ -25,6 +25,7 @@ class CosmicBot(teambot.Handler):
|
||||||
self.tasks = tasks.TaskPool()
|
self.tasks = tasks.TaskPool()
|
||||||
self.tasks.add_coroutine(self.check_rss,12,dict(url=feed_url,known=[],channel="#cosmic"))
|
self.tasks.add_coroutine(self.check_rss,12,dict(url=feed_url,known=[],channel="#cosmic"))
|
||||||
self.tasks.load_state(0)
|
self.tasks.load_state(0)
|
||||||
|
atexit.register(lambda: self.tasks.save_state(0))
|
||||||
def load_modules(self):
|
def load_modules(self):
|
||||||
plugin.clear()
|
plugin.clear()
|
||||||
for module in os.listdir("commands"):
|
for module in os.listdir("commands"):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user