From 46fd6ab38e7c66f444c21779cd2a51a03eaddabf Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Mon, 1 Apr 2024 17:52:39 +0000 Subject: [PATCH] Lady Yukari proceeds to smack Chen with her umbrella Signed-off-by: Izuru Yakumo git-svn-id: file:///srv/svn/repo/chen/trunk@36 32723744-9b23-0b4a-b1da-9b2e968f9461 --- config.ini.default | 2 +- main.py | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/config.ini.default b/config.ini.default index 6170b29..d10382e 100644 --- a/config.ini.default +++ b/config.ini.default @@ -1,6 +1,6 @@ [chen] jid = chen@example.com password = b0TPA55W0rD +prefix = ! nick = Chen autojoin = room1@muc.example.com room2@muc.example.com room3@muc.example.com -prefix = ! diff --git a/main.py b/main.py index 83144e1..c3addba 100644 --- a/main.py +++ b/main.py @@ -136,7 +136,7 @@ class ChenBot(ClientXMPP): fname = filename if filename else f"file{ext}" await self.embed_file(url, sender, mtype, ftype, fname, outfile) except Exception as e: - print(e) + print(e) async def embed_file(self, url, sender, mtype, ftype, fname, outfile): """Embed a file and send the result to the sender.""" @@ -295,24 +295,29 @@ class ChenBot(ClientXMPP): if ctx: return bot.send_message( - mto=sender, mbody=f"{msg['mucnick']}: https://git.chaotic.ninja/usr/yakumo_izuru/chen", mtype="groupchat", + mto=sender, + mbody=f"{msg['mucnick']}: https://git.chaotic.ninja/usr/yakumo_izuru/chen", + mtype="groupchat", + ) + + @self.word + def repo(msg, ctx, sender): + if ctx: + return + bot.send_message( + mto=sender, + mbody=f"{msg.get_from().bare}: https://git.chaotic.ninja/usr/yakumo_izuru/chen", + mtype="chat", ) - @self.word - def repo(msg, ctx, sender): - if ctx: - return - bot.send_message( - mto=sender, mbody=f"{msg.get_from().bare}: https://git.chaotic.ninja/usr/yakumo_izuru/chen", mtype="chat", - ) 2 if __name__ == "__main__": config = configparser.ConfigParser() config.read("config.ini") jid = config["chen"]["jid"] - prefix = config["chen"]["prefix"] password = config["chen"]["password"] + prefix = config["chen"]["prefix"] nick = config["chen"]["nick"] autojoin = config["chen"]["autojoin"].split() bot = ChenBot(jid, password, nick, prefix, autojoin=autojoin)