Update slixfeed.py

This commit is contained in:
Schimon Jehudah 2022-06-30 15:17:46 +00:00
parent 51df9cc9d2
commit be04cfec89

View file

@ -109,6 +109,14 @@ class Slixfeed(slixmpp.ClientXMPP):
action = initdb(msg['from'].bare, action = initdb(msg['from'].bare,
message[12:], message[12:],
toggle_status) toggle_status)
elif message.startswith('feed enable'):
action = initdb(msg['from'].bare,
message[11:],
toggle_state)
elif message.startswith('feed disable'):
action = initdb(msg['from'].bare,
message[12:],
toggle_state)
else: else:
action = "Unknown command. Press \"help\" for list of commands" action = "Unknown command. Press \"help\" for list of commands"
msg.reply(action).send() msg.reply(action).send()
@ -151,7 +159,13 @@ class Slixfeed(slixmpp.ClientXMPP):
os.chdir(db_dir) os.chdir(db_dir)
files = os.listdir() files = os.listdir()
for file in files: for file in files:
if not file.endswith('.db-jour.db'):
jid = file[:-3] jid = file[:-3]
# TODO check if jid online
# https://slixmpp.readthedocs.io/en/latest/api/plugins/xep_0199.html
# d = self.send_ping(self, jid)
# print('d')
# print(d)
new = initdb(jid, False, get_unread) new = initdb(jid, False, get_unread)
if new: if new:
msg = self.make_message(mto=jid, mbody=new, msg = self.make_message(mto=jid, mbody=new,
@ -183,6 +197,10 @@ def print_help():
" Slixfeed is an aggregator bot for online news feeds. \n" " Slixfeed is an aggregator bot for online news feeds. \n"
"\n" "\n"
"BASIC USAGE: \n" "BASIC USAGE: \n"
" feed enable \n"
" Send updates. \n"
" feed disable \n"
" Don't send updates. \n"
" feed list \n" " feed list \n"
" List subscriptions list. \n" " List subscriptions list. \n"
"\n" "\n"