cleanup/bugfixes

This commit is contained in:
2019-03-10 17:05:59 +01:00
parent 5f2e2e517d
commit 09c69468a8
2 changed files with 9 additions and 2 deletions

View File

@@ -36,6 +36,8 @@ class CommandHandler():
"""nolist Show debug info"""
return pprint.pformat(self.__dict__)
#TODO: handle non-existant commands
#TODO: add end text
def help(self, *args, **kwargs):
"""List available commands"""
#taken from https://www.python.org/dev/peps/pep-0257/#handling-docstring-indentation
@@ -112,13 +114,13 @@ class GateCommandHandler(CommandHandler):
gate.spawn_tg_client(self.jid, phone_no)
if gate.tg_connections[self.jid].is_user_authorized():
gate.send_presence(pto=jid, pfrom=gate.boundjid.bare, ptype='online', pstatus='connected')
# gate.send_presence(pto=jid, pfrom=gate.boundjid.bare, ptype='online', pstatus='connected') #already called in spawn_tg_client
return "You are already authenticated in Telegram"
else:
# remove old sessions for this JID #
gate.db_connection.execute("DELETE from accounts where jid = ?", (self.jid,))
gate.tg_connections[self.jid].send_code_request(phone_no)
gate._update('Gate is connected. Telegram should send SMS message to you.')
self._update('Gate is connected. Telegram should send SMS message to you.')
return 'Please enter one-time code via !code 12345.'
def code(self, gate):