Fix stupid things
This commit is contained in:
parent
82c405020a
commit
32c308958f
|
@ -45,13 +45,12 @@ class EchoBot(sleekxmpp.ClientXMPP):
|
||||||
try:
|
try:
|
||||||
for update in self.bot.getUpdates(offset=update_id,
|
for update in self.bot.getUpdates(offset=update_id,
|
||||||
timeout=10):
|
timeout=10):
|
||||||
update_id = update.update_id + 1
|
|
||||||
message = update.message.text
|
message = update.message.text
|
||||||
user = str(update.message.from_user.username)
|
user = str(update.message.from_user.username)
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
user = str(update.message.from_user.first_name)
|
user = str(update.message.from_user.first_name)
|
||||||
if not user:
|
|
||||||
user = "Unidentified: "
|
|
||||||
mensaje = user + ": " + message
|
mensaje = user + ": " + message
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
|
|
||||||
|
@ -59,10 +58,12 @@ class EchoBot(sleekxmpp.ClientXMPP):
|
||||||
self.send_message(mto=self.muc_room,
|
self.send_message(mto=self.muc_room,
|
||||||
mbody=mensaje,
|
mbody=mensaje,
|
||||||
mtype='groupchat')
|
mtype='groupchat')
|
||||||
|
update_id = update.update_id + 1
|
||||||
|
|
||||||
except NetworkError:
|
except NetworkError:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
except Unauthorized:
|
except Unauthorized:
|
||||||
update_id += 1
|
sleep(1)
|
||||||
|
|
||||||
def start(self, event):
|
def start(self, event):
|
||||||
self.get_roster()
|
self.get_roster()
|
||||||
|
@ -70,12 +71,9 @@ class EchoBot(sleekxmpp.ClientXMPP):
|
||||||
self.plugin['xep_0045'].joinMUC(self.muc_room, self.nick, wait=True)
|
self.plugin['xep_0045'].joinMUC(self.muc_room, self.nick, wait=True)
|
||||||
|
|
||||||
def muc_message(self, msg):
|
def muc_message(self, msg):
|
||||||
print(msg)
|
|
||||||
if msg['mucnick'] != self.nick:
|
if msg['mucnick'] != self.nick:
|
||||||
mensaje = str(msg['from']).split('/')[1] + ': ' + str(msg['body'])
|
mensaje = str(msg['from']).split('/')[1] + ': ' + str(msg['body'])
|
||||||
print(mensaje)
|
|
||||||
self.bot.sendMessage(self.group, text=mensaje)
|
self.bot.sendMessage(self.group, text=mensaje)
|
||||||
print("fuera")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue