From dc1e0d42af3a5a24a79b3fca726c156254e7f029 Mon Sep 17 00:00:00 2001 From: fram3d Date: Tue, 6 Feb 2024 00:40:23 +0100 Subject: [PATCH] move functions to seperate file --- .gitignore | 1 + chatbot | 7 +------ config.ini | 2 +- functions.py | 5 +++++ 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 functions.py diff --git a/.gitignore b/.gitignore index 2fa7ce7..948a4f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ config.ini +__pycache__ diff --git a/chatbot b/chatbot index 6021d93..4bccffb 100755 --- a/chatbot +++ b/chatbot @@ -3,17 +3,12 @@ import argparse import slixmpp import configparser +from functions import * CONFIG_PATH = "./config.ini" VERSION='0.1.0' -def processmsg(msg, rcpt): - if msg.startswith("!"): - return "" - elif "youtube.com/watch" in msg: - return msg.replace("youtube.com", "iv.datura.network") - def show_version(): print("chatbot " + VERSION) print("License AGPLv3+: GNU AGPL version 3 or later ") diff --git a/config.ini b/config.ini index e4315bd..5cd15b7 100644 --- a/config.ini +++ b/config.ini @@ -1,5 +1,5 @@ [credentials] JID = botusername@example.org PASSWORD = bot_password -NICK = mirrorbot +NICK = chatbot ROOM = room_jid@example.org diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..1631ce8 --- /dev/null +++ b/functions.py @@ -0,0 +1,5 @@ +def processmsg(msg, rcpt): + if msg.startswith("!"): + return "" + elif "youtube.com/watch" in msg: + return msg.replace("youtube.com", "iv.datura.network")