fix typos

This commit is contained in:
fram3d 2024-02-05 20:39:28 +01:00
parent 3b86c53c7c
commit c914de3358
Signed by: fram3d
GPG Key ID: 938920E709EEA32A

11
chatbot
View File

@ -9,7 +9,7 @@ CONFIG_PATH = "./config.ini"
VERSION='0.1.0' VERSION='0.1.0'
def processmsg(msg, rcpt): def processmsg(msg, rcpt):
if !msg.startswith("!"): if msg.startswith("!"):
return "" return ""
elif "youtube.com/watch" in msg: elif "youtube.com/watch" in msg:
return msg.replace("youtube.com", "iv.datura.network") return msg.replace("youtube.com", "iv.datura.network")
@ -38,9 +38,10 @@ class MUCBot(slixmpp.ClientXMPP):
def muc_message(self, msg): def muc_message(self, msg):
rcpt=msg['from'].bare rcpt=msg['from'].bare
processmsg(msg['body'], rcpt) answer = processmsg(msg['body'], rcpt)
if msg['mucnick'] != self.nick): if msg['mucnick'] != self.nick:
self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],msg['body']),mtype='groupchat') if answer is not None:
self.send_message(mto=rcpt,mbody="%s: %s" % (msg['mucnick'],answer),mtype='groupchat')
if __name__ == '__main__': if __name__ == '__main__':
@ -58,7 +59,7 @@ if __name__ == '__main__':
JID = config.get('credentials', 'JID') JID = config.get('credentials', 'JID')
PASSWORD = config.get('credentials', 'PASSWORD') PASSWORD = config.get('credentials', 'PASSWORD')
NICK = config.get('credentials', 'NICK') NICK = config.get('credentials', 'NICK')
ROOM1 = config.get('credentials', 'ROOM') ROOM = config.get('credentials', 'ROOM')
HOST = None HOST = None
PORT = 5222 PORT = 5222
if "host" in config.options('credentials'): if "host" in config.options('credentials'):