From 4f07b24c6d861aa429a77ec0871d5876831f6075 Mon Sep 17 00:00:00 2001 From: Yannik Enss Date: Wed, 27 Feb 2019 00:29:04 +0100 Subject: [PATCH] bugfixing --- xmpp_tg/xmpp.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/xmpp_tg/xmpp.py b/xmpp_tg/xmpp.py index a24876b..efd151a 100644 --- a/xmpp_tg/xmpp.py +++ b/xmpp_tg/xmpp.py @@ -472,7 +472,8 @@ class XMPPTelegram(ComponentXMPP): time.sleep(1) self.tg_process_dialogs(jid) - def group(self): #2 args + def group(hndl, self): #2 args + """Creat a Group""" hndl._min_args(2) # group name? # groupname = parsed[1] @@ -484,19 +485,18 @@ class XMPPTelegram(ComponentXMPP): self.tg_connections[jid].invoke(CreateChatRequest([groupuser], groupname)) self.tg_process_dialogs(jid) - def channel(self): #1 arg - hndl._min_args(1) - groupname = parsed[1] - self.tg_connections[jid].invoke(CreateChannelRequest(groupname, groupname, broadcast = True)) - self.tg_process_dialogs(jid) - def supergroup(self): #1 arg + def supergroup(hndl, self): #1 arg + """Create a channel""" hndl._min_args(1) - groupname = parsed[1] - self.tg_connections[jid].invoke(CreateChannelRequest(groupname, groupname, megagroup = True)) - self.tg_process_dialogs(jid) - def username(self): #1 arg + groupname = hndl.arguments[0] + self.tg_connections[hndl.jid].invoke(CreateChannelRequest(groupname, groupname, megagroup = True)) + self.tg_process_dialogs(hndl.jid) + + channel = supergroup + + def username(hndl, self): #1 arg """Change your Telegram nickname""" hndl._min_args(1) @@ -585,7 +585,9 @@ class XMPPTelegram(ComponentXMPP): reply = str(handler(self)) except Exception as e: if self.config["debug"]: - reply = traceback.format_exc() + reply = "******* DEBUG MODE ACTIVE *********\n" + reply += "An Exception occured while executing this command:" + reply += traceback.format_exc() else: if isinstance(e, NotAuthorizedError): reply = str(e)