From f8bcbca7c7a459fd0cf62d721ef1e22ad5a99166 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:04:14 -0800 Subject: [PATCH 01/30] patch --- sweebot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sweebot.py b/sweebot.py index 307d2a9..ab307bf 100644 --- a/sweebot.py +++ b/sweebot.py @@ -21,16 +21,16 @@ from flask import Flask, send_file app = Flask(__name__) @app.route('/') -def index(): +def index_html(): return send_file("sweebot.html", mimetype='text/html') @app.route('/run.txt') -def run(): +def runs(): return str(run) @app.route('/block.txt') -def block(): +def blocks(): return str(block) @app.route('/script.js') -def script(): +def script_js(): return send_file("script.js", mimetype='application/javascript') threading.Thread(target=app.run, daemon=True, kwargs={"port": 2005}).start() -- 2.39.5 From 897f70911ae6b7318dd240d56ebba1208a8a9533 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:09:55 -0800 Subject: [PATCH 02/30] change name --- sweebot.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sweebot.html b/sweebot.html index 48456ed..262e130 100644 --- a/sweebot.html +++ b/sweebot.html @@ -1,14 +1,13 @@ -SweeBot dashboard +MeowNexUS IRC - Dashboard
-

SweeBot Dashboard

+

MeowNexUS IRC

-

-- 2.39.5 From 2ee01f1b387b4ae7fd9d93b5617994d78df63d9b Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:12:43 -0800 Subject: [PATCH 03/30] Update script.js --- script.js | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/script.js b/script.js index 078daad..5160fd3 100644 --- a/script.js +++ b/script.js @@ -1,32 +1,20 @@ -var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) -var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { - return new bootstrap.Tooltip(tooltipTriggerEl) -}) -const delay = ms => new Promise(res => setTimeout(res, ms)); +// Fetching the run value for the first time fetch ("run.txt") -.then(x => x.text()) -.then(y => document.getElementById("run").innerHTML = y); -fetch ("block.txt") -.then(x => x.text()) -.then(y => document.getElementById("blocked").innerHTML = y); -async function reboot(){ - document.getElementById("rebooticon").innerHTML = "" - fetch ("reboot.run") .then(x => x.text()) - .then(y => document.getElementById("rebooticon").innerHTML = y); - await delay(2000) - document.getElementById("rebooticon").innerHTML = "" -} -async function refresh(){ -document.getElementById("refresh").innerHTML = "" -document.getElementById("run").innerHTML = "" -document.getElementById("blocked").innerHTML = "" -fetch ("run.txt") -.then(x => x.text()) -.then(y => document.getElementById("run").innerHTML = y) + .then(y => document.getElementById("run").innerHTML = y); +// Fetching the block value for the first time fetch ("block.txt") -.then(x => x.text()) -.then(y => document.getElementById("blocked").innerHTML = y); -await delay(2000) -document.getElementById("refresh").innerHTML = "" + .then(x => x.text()) + .then(y => document.getElementById("blocked").innerHTML = y); +async function refresh(){ + // Refresh the HTML to show the spinners + document.getElementById("run").innerHTML = "" + document.getElementById("blocked").innerHTML = "" + // Then fetch the values the same way as on the first part of the script. + fetch ("run.txt") + .then(x => x.text()) + .then(y => document.getElementById("run").innerHTML = y) + fetch ("block.txt") + .then(x => x.text()) + .then(y => document.getElementById("blocked").innerHTML = y); } \ No newline at end of file -- 2.39.5 From 63bbff3be8a29a7932d4ae78562c4680a949bdc9 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:12:56 -0800 Subject: [PATCH 04/30] Delete sweebot-dashboard.py --- sweebot-dashboard.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 sweebot-dashboard.py diff --git a/sweebot-dashboard.py b/sweebot-dashboard.py deleted file mode 100644 index bd55bae..0000000 --- a/sweebot-dashboard.py +++ /dev/null @@ -1,30 +0,0 @@ -from flask import Flask -from flask import send_file -from flask import request -from flask import redirect -import os -from pathlib import Path -from time import sleep as wait -app = Flask(__name__) - -@app.route('/') -def index(): - return send_file("sweebot.html", mimetype='text/html') -@app.route('/run.txt') -def run(): - wait(2) - return send_file(str(Path.home()) + "/run.txt", mimetype='text/html') -@app.route('/block.txt') -def block(): - wait(2) - return send_file(str(Path.home()) + "/block.txt", mimetype='text/html') -@app.route('/script.js') -def script(): - return send_file("script.js", mimetype='application/javascript') - - -if __name__ == '__main__': - - # run() method of Flask class runs the application - # on the local development server. - app.run(host='0.0.0.0',port=2001) \ No newline at end of file -- 2.39.5 From 368ddcd885373a17f7c45d5b4eb70333d8b9c864 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:17:00 -0800 Subject: [PATCH 05/30] Use SweeStyle instead of Bootstrap 5 --- sweebot.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sweebot.html b/sweebot.html index 262e130..4e6dc6c 100644 --- a/sweebot.html +++ b/sweebot.html @@ -1,16 +1,14 @@ MeowNexUS IRC - Dashboard - - - - + +

MeowNexUS IRC

-

-

+

...


+

...




- + Refresh
-- 2.39.5 From 51ddc2fdf223a4998260e3b0d4175c5f45dfd005 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:17:40 -0800 Subject: [PATCH 06/30] Use SweeStyle instead of FontAwesome --- script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 5160fd3..5b0d297 100644 --- a/script.js +++ b/script.js @@ -8,8 +8,8 @@ fetch ("block.txt") .then(y => document.getElementById("blocked").innerHTML = y); async function refresh(){ // Refresh the HTML to show the spinners - document.getElementById("run").innerHTML = "" - document.getElementById("blocked").innerHTML = "" + document.getElementById("run").innerHTML = "..." + document.getElementById("blocked").innerHTML = "..." // Then fetch the values the same way as on the first part of the script. fetch ("run.txt") .then(x => x.text()) -- 2.39.5 From a65ce4a183ee605e4764c3603e88a0fc7511bfcc Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:18:07 -0800 Subject: [PATCH 07/30] Update sweebot.html --- sweebot.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sweebot.html b/sweebot.html index 4e6dc6c..924981b 100644 --- a/sweebot.html +++ b/sweebot.html @@ -4,8 +4,8 @@

MeowNexUS IRC

-

...


-

...


+

...

+

...



Refresh -- 2.39.5 From 6147a185f55bff1d4c134ac2eb1445a1e0f2aef7 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:19:08 -0800 Subject: [PATCH 08/30] Unnecessary use of h3 --- sweebot.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sweebot.html b/sweebot.html index 924981b..9b242db 100644 --- a/sweebot.html +++ b/sweebot.html @@ -4,8 +4,8 @@

MeowNexUS IRC

-

...

-

...

+ ...
+ ...


Refresh -- 2.39.5 From aaaae7b9de1f76bbeef3c36801fc2451388719e6 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:24:47 -0800 Subject: [PATCH 09/30] Update sweebot.html --- sweebot.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sweebot.html b/sweebot.html index 9b242db..f592e18 100644 --- a/sweebot.html +++ b/sweebot.html @@ -1,5 +1,5 @@ - MeowNexUS IRC - Dashboard +
@@ -8,7 +8,7 @@ ...


- Refresh +
-- 2.39.5 From 525bd85283960ce1e3b7ef13db1d034d3810dab0 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:27:57 -0800 Subject: [PATCH 10/30] Update dashboard.html --- sweebot.html => dashboard.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename sweebot.html => dashboard.html (63%) diff --git a/sweebot.html b/dashboard.html similarity index 63% rename from sweebot.html rename to dashboard.html index f592e18..ee936c6 100644 --- a/sweebot.html +++ b/dashboard.html @@ -4,11 +4,13 @@

MeowNexUS IRC

+ ...
...
+ ...


- +
-- 2.39.5 From 7e99e730114890d17c989921469e6aee4aebe34b Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:28:49 -0800 Subject: [PATCH 11/30] Update script.js --- script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script.js b/script.js index 5b0d297..36e2249 100644 --- a/script.js +++ b/script.js @@ -6,6 +6,9 @@ fetch ("run.txt") fetch ("block.txt") .then(x => x.text()) .then(y => document.getElementById("blocked").innerHTML = y); +fetch ("link.txt") + .then(x => x.text()) + .then(y => document.getElementById("links").innerHTML = y); async function refresh(){ // Refresh the HTML to show the spinners document.getElementById("run").innerHTML = "..." @@ -17,4 +20,7 @@ async function refresh(){ fetch ("block.txt") .then(x => x.text()) .then(y => document.getElementById("blocked").innerHTML = y); + fetch ("link.txt") + .then(x => x.text()) + .then(y => document.getElementById("links").innerHTML = y); } \ No newline at end of file -- 2.39.5 From 4e9da369dbeb2a4f1bd8c31cc13c0601f53971f8 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:30:35 -0800 Subject: [PATCH 12/30] Update sweebot.py --- sweebot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index ab307bf..30c91e7 100644 --- a/sweebot.py +++ b/sweebot.py @@ -22,13 +22,16 @@ app = Flask(__name__) @app.route('/') def index_html(): - return send_file("sweebot.html", mimetype='text/html') + return send_file("dashboard.html", mimetype='text/html') @app.route('/run.txt') def runs(): return str(run) @app.route('/block.txt') def blocks(): return str(block) +@app.route('/link.txt') +def blocks(): + return str(parsed) @app.route('/script.js') def script_js(): return send_file("script.js", mimetype='application/javascript') @@ -687,6 +690,7 @@ while True: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: multiline("(" + nick + ") [" + humanbytes(content_len) + " " + str(content_type) + "]", channel) + parsed += 1 except rex.SSLError as ex: multiline("(" + nick + ") [SSL Error: " + str(ex.message) + "]", channel) except Exception as ex: @@ -704,6 +708,7 @@ while True: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: multiline("(" + nick + ") [" + humanbytes(content_len) + " " + str(content_type) + "]", channel) + parsed += 1 except: print(traceback.format_exc()) elif "JOIN" in text and "#nixsanctuary" in text: -- 2.39.5 From 9f5f47c61de51e0ef38ede8bb76dc07c496e0e18 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:31:19 -0800 Subject: [PATCH 13/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 30c91e7..ba33894 100644 --- a/sweebot.py +++ b/sweebot.py @@ -30,7 +30,7 @@ def runs(): def blocks(): return str(block) @app.route('/link.txt') -def blocks(): +def parses(): return str(parsed) @app.route('/script.js') def script_js(): -- 2.39.5 From 680143fcf9bfafa7e807675755de4e9b72aa6b75 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:32:10 -0800 Subject: [PATCH 14/30] Update sweebot.py --- sweebot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sweebot.py b/sweebot.py index ba33894..d401900 100644 --- a/sweebot.py +++ b/sweebot.py @@ -16,6 +16,7 @@ from googleapiclient.discovery import build run = 0 block = 0 +parsed = 0 # Dashboard thread from flask import Flask, send_file app = Flask(__name__) -- 2.39.5 From 149e6bf851314335627f825cff3faa632340fb96 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:32:49 -0800 Subject: [PATCH 15/30] Update script.js --- script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/script.js b/script.js index 36e2249..54c44c9 100644 --- a/script.js +++ b/script.js @@ -13,6 +13,7 @@ async function refresh(){ // Refresh the HTML to show the spinners document.getElementById("run").innerHTML = "..." document.getElementById("blocked").innerHTML = "..." + document.getElementById("links").innerHTML = "..." // Then fetch the values the same way as on the first part of the script. fetch ("run.txt") .then(x => x.text()) -- 2.39.5 From 71bbdbbc5e0c65dd232cef911fd3fe10c23b06fd Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:34:21 -0800 Subject: [PATCH 16/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index d401900..4cefbb6 100644 --- a/sweebot.py +++ b/sweebot.py @@ -709,7 +709,7 @@ while True: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: multiline("(" + nick + ") [" + humanbytes(content_len) + " " + str(content_type) + "]", channel) - parsed += 1 + parsed += 1 except: print(traceback.format_exc()) elif "JOIN" in text and "#nixsanctuary" in text: -- 2.39.5 From 10cdf397004c7bb640e0a69c49fbd90073d3c1c4 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:36:36 -0800 Subject: [PATCH 17/30] Update sweebot.py --- sweebot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 4cefbb6..1431e15 100644 --- a/sweebot.py +++ b/sweebot.py @@ -485,7 +485,8 @@ while True: multiline(choice(meows_upset), channel) else: multiline(choice(meows_happy), channel) - + elif command[0] == "$stats": + multiline(f"{nick}: {run} commands run, {block} refused, and {parsed} links parsed, check out https://irc-bot.swee.codes") elif command[0] == "$shell": if perms == "full": #or "shell" in perms.split(",") -- 2.39.5 From 28647f1a63d031036dfdf5331d4e9a03d6346036 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:37:27 -0800 Subject: [PATCH 18/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 1431e15..8a75873 100644 --- a/sweebot.py +++ b/sweebot.py @@ -486,7 +486,7 @@ while True: else: multiline(choice(meows_happy), channel) elif command[0] == "$stats": - multiline(f"{nick}: {run} commands run, {block} refused, and {parsed} links parsed, check out https://irc-bot.swee.codes") + multiline(f"{nick}: {run} commands run, {block} refused, and {parsed} links parsed, check out https://irc-bot.swee.codes", channel) elif command[0] == "$shell": if perms == "full": #or "shell" in perms.split(",") -- 2.39.5 From 85730a0d23988af0ae6165c718b2ad330916445b Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:38:09 -0800 Subject: [PATCH 19/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 8a75873..bb74c58 100644 --- a/sweebot.py +++ b/sweebot.py @@ -486,7 +486,7 @@ while True: else: multiline(choice(meows_happy), channel) elif command[0] == "$stats": - multiline(f"{nick}: {run} commands run, {block} refused, and {parsed} links parsed, check out https://irc-bot.swee.codes", channel) + multiline(f"{nick}: {run} command(s) run, {block} refused, and {parsed} link(s) parsed, check out https://irc-bot.swee.codes", channel) elif command[0] == "$shell": if perms == "full": #or "shell" in perms.split(",") -- 2.39.5 From 369d6a042cdd75a816e9de69cacfb824ea71c759 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 18:44:26 -0800 Subject: [PATCH 20/30] Update sweebot.py --- sweebot.py | 53 ++++++++++++----------------------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/sweebot.py b/sweebot.py index bb74c58..3c9612d 100644 --- a/sweebot.py +++ b/sweebot.py @@ -1,4 +1,4 @@ -__version__ = "0.0.2 Funni update" +__version__ = "0.0.2 Funni update" + ". https://git.swee.codes/MeowNex" import socket import subprocess from time import sleep, time, ctime @@ -223,6 +223,7 @@ baps = ["T-T", "Ow!", "Beep!"] pats = ["-w-", "Meep...", "Prr!"] meows_happy = ['Meow!', 'Nyaa~', 'Mrow.', 'Prr! :3', "Mrrp?", "Mreow.", "!woeM", "3: !rrP", "~aayN", "Mew!", "Moew!"] meows_upset = ['Hiss!', "!ssiH", "Grrr..."] +my_self = ["MeowNexUS", "MeowNexU5", "MeowN3xUS"] happiness = 5 global times times = 0 @@ -318,7 +319,7 @@ while True: pass try: #if True: - if "PRIVMSG" in text: + if "PRIVMSG" in text and not nick in my_self: if "PRIVMSG" in text and command[0][0] == "$": run+=1 update() @@ -561,45 +562,15 @@ while True: multiline(f"\x01ACTION gives a hug to {name}\x01", channel) - - #elif command[0] == "$sed": - # if len(command) > 1: - #try: - # if True: - # com = ['sed',"" + command[1] + ""] - # print(command[1]) - # texte = open("log-text-"+channel).read().split("\n") - # texte.reverse() - # texte.pop(0) - # texte.pop(0) - # print(texte) - # texttoreplace = "" - # j = 0 - # broken = False - # for i in texte: - # if command[1].split("/")[1] in i: - # texttoreplace = i - # broken = True - # break - # j+=1 - # if not broken: - # irc.send_irc(channel, "Unable to correct: '" + command[1].split("/")[1] + "' not found in any chat message.") - # continue - # namee = open("log-name-"+channel).read().split("\n") - # namee.reverse() - # namee.pop(0) - # namee.pop(0) - # namee = namee[j] - # open("temp","w").write(texttoreplace) - # com.append("temp") - # print(com) - # result = subprocess.run(com, stdout=subprocess.PIPE) - # output = result.stdout.decode('utf-8').split("\n") - # irc.send_irc(channel, "Correction using sed: <" + namee + "> " + output[0]) - # #except Exception as ex: - # #irc.send_irc(channel, nick + ": " + ex.__class__.__name__) - # else: - # irc.send_irc(channel, nick + ": What to correct?") + elif command[0] == "$sed": + if len(command) > 1: + try: + #if True: + raise Exception("WorkInProgress!!!") + except: + print(traceback.format_exc()) + else: + irc.send_irc(channel, nick + ": What to correct?") elif command[0] == "$config": -- 2.39.5 From e58abcda8da2847e6ac30526bd89ffaa709812a9 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:02:43 -0800 Subject: [PATCH 21/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 3c9612d..4f4617b 100644 --- a/sweebot.py +++ b/sweebot.py @@ -349,7 +349,7 @@ while True: irc.send_irc(channel, "tip, ping, whoami, perms, version, figlet, tdfiglet, cowsay, uptime, cc, joke, botsnack. (restart, join, part, shell, config, pull.) Use '$help (command)' for explanation.") elif command[0] == "$tip": - system(["fortune"], channel) + system(["/usr/games/fortune", "debian-hints"], channel) elif command[0] == "$whoami": if perms != "": -- 2.39.5 From 6b55d21f9166f9d6d2fed73db2150e4b32c352c4 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:07:34 -0800 Subject: [PATCH 22/30] Update sweebot.py --- sweebot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sweebot.py b/sweebot.py index 4f4617b..ae45b85 100644 --- a/sweebot.py +++ b/sweebot.py @@ -273,12 +273,18 @@ def restart(): irc2.irc_socket.close() irc3.irc_socket.close() exit(0) -def system(cmd, chan): +def system(cmd, chan, rstrip=False): try: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + outpp = "" for line in iter(p.stdout.readline, b''): if text != "" and text != " ": - multiline(line.rstrip(), chan) + if not rstrip + multiline(line.rstrip(), chan) + else: + outpp += line.rstrip() + " " + if rstrip: + multiline(outpp[:-1]) p.stdout.close() p.wait() except FileNotFoundError: @@ -349,7 +355,7 @@ while True: irc.send_irc(channel, "tip, ping, whoami, perms, version, figlet, tdfiglet, cowsay, uptime, cc, joke, botsnack. (restart, join, part, shell, config, pull.) Use '$help (command)' for explanation.") elif command[0] == "$tip": - system(["/usr/games/fortune", "debian-hints"], channel) + system(["/usr/games/fortune", "debian-hints"], channel, True) elif command[0] == "$whoami": if perms != "": -- 2.39.5 From e69e5c6ab26ad33c61e32bd12d212edd0242e911 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:08:54 -0800 Subject: [PATCH 23/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index ae45b85..7f5fff0 100644 --- a/sweebot.py +++ b/sweebot.py @@ -279,7 +279,7 @@ def system(cmd, chan, rstrip=False): outpp = "" for line in iter(p.stdout.readline, b''): if text != "" and text != " ": - if not rstrip + if not rstrip: multiline(line.rstrip(), chan) else: outpp += line.rstrip() + " " -- 2.39.5 From fc19c7c0d3719d55a5055707e47e892fbe787040 Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:10:16 -0800 Subject: [PATCH 24/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 7f5fff0..f721009 100644 --- a/sweebot.py +++ b/sweebot.py @@ -282,7 +282,7 @@ def system(cmd, chan, rstrip=False): if not rstrip: multiline(line.rstrip(), chan) else: - outpp += line.rstrip() + " " + outpp += line.decode().rstrip() + " " if rstrip: multiline(outpp[:-1]) p.stdout.close() -- 2.39.5 From b626e42b76bc14c32227fe94c639582e1b61a7ba Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:10:56 -0800 Subject: [PATCH 25/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index f721009..1d41d6f 100644 --- a/sweebot.py +++ b/sweebot.py @@ -290,7 +290,7 @@ def system(cmd, chan, rstrip=False): except FileNotFoundError: multiline(cmd[0] + " not found", chan) except: - multiline(traceback.format_exc()) + multiline(traceback.format_exc(), chan) irl2 = threading.Thread(target=irci2, daemon=True) irl2.start() irl3 = threading.Thread(target=irci3, daemon=True) -- 2.39.5 From aebcdb825595d0852dde0288776c9611ac189a0e Mon Sep 17 00:00:00 2001 From: swee Date: Fri, 6 Dec 2024 23:11:51 -0800 Subject: [PATCH 26/30] Update sweebot.py --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 1d41d6f..1297ad9 100644 --- a/sweebot.py +++ b/sweebot.py @@ -284,7 +284,7 @@ def system(cmd, chan, rstrip=False): else: outpp += line.decode().rstrip() + " " if rstrip: - multiline(outpp[:-1]) + multiline(outpp[:-1], chan) p.stdout.close() p.wait() except FileNotFoundError: -- 2.39.5 From e19a1475216a33ce86969a90645dc8b4f83d3fb2 Mon Sep 17 00:00:00 2001 From: Nova Cat Date: Sun, 8 Dec 2024 10:48:53 -0800 Subject: [PATCH 27/30] Remove the update function --- sweebot.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/sweebot.py b/sweebot.py index 1297ad9..bb530aa 100644 --- a/sweebot.py +++ b/sweebot.py @@ -227,11 +227,6 @@ my_self = ["MeowNexUS", "MeowNexU5", "MeowN3xUS"] happiness = 5 global times times = 0 -def update(): - open(str(Path.home()) + "/run.txt", 'w').write(str(run)) - open(str(Path.home()) + "/block.txt", 'w').write(str(block)) - -update() def irci2(): irc2.connect_irc( server_irc, port_irc, channel_irc, "sweeB0t", botpass_irc, botnickpass_irc + "/B" @@ -328,7 +323,6 @@ while True: if "PRIVMSG" in text and not nick in my_self: if "PRIVMSG" in text and command[0][0] == "$": run+=1 - update() if command[0] == "$ping": if random(1,2) == 1: irc.send_irc(channel, nick + ": Pnog") @@ -341,7 +335,7 @@ while True: irc.send_irc(channel, nick + ": Nice try") block+=1 run-=1 - update() + else: try: if path.isfile(cwd + "/helps/" + " ".join(command[1:])): @@ -391,7 +385,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$pull": if perms == "full" or "git" in perms.split(","): @@ -404,7 +398,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$join": if perms == "full" or "join" in perms.split(","): @@ -423,7 +417,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$part": if perms == "full" or "part" in perms.split(","): @@ -445,7 +439,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$socket": if perms == "full": @@ -460,7 +454,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$patpat" or command[0] == "$headpat": if len(command) == 2: @@ -508,7 +502,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied.") block+=1 run-=1 - update() + elif command[0] == "$version": irc.send_irc(channel, "This is SweeBot " + __version__) @@ -610,7 +604,7 @@ while True: irc.send_irc(channel, nick + ": Permission denied") block+=1 run-=1 - update() + else: multiline("Configuration for " + channel + ": " + " ".join(sbconfig.chansettings(channel)), channel) except ex: @@ -621,7 +615,7 @@ while True: irc.send_irc(channel, nick + ": Nice try.") block+=1 run-=1 - update() + else: if path.isfile("cc/" + command[0][1:]): try: -- 2.39.5 From b7f777bd0a83df64243da2483a11fc7fb22af028 Mon Sep 17 00:00:00 2001 From: Nova Cat Date: Sun, 8 Dec 2024 10:50:27 -0800 Subject: [PATCH 28/30] remove newlines from page title, only show 100 characters of the title --- sweebot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sweebot.py b/sweebot.py index bb530aa..3a91928 100644 --- a/sweebot.py +++ b/sweebot.py @@ -658,7 +658,7 @@ while True: if content_type in allowedparse: if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + (soup.title.string if soup.title != None else "[No title provided]"), channel) + multiline("(" + nick + ") " + (soup.title.string.rstrip()[:100] if soup.title != None else "[No title provided]"), channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: @@ -676,7 +676,7 @@ while True: if content_type in allowedparse: if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + (soup.title.string if soup.title != None else "[No title provided]"), channel) + multiline("(" + nick + ") " + (soup.title.string.rstrip()[:100] if soup.title != None else "[No title provided]"), channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: -- 2.39.5 From 0fc91a8aab1147ce6337fd4d45bdcb1fac31fab7 Mon Sep 17 00:00:00 2001 From: Nova Cat Date: Sun, 8 Dec 2024 10:53:39 -0800 Subject: [PATCH 29/30] again --- sweebot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sweebot.py b/sweebot.py index 3a91928..0f6413c 100644 --- a/sweebot.py +++ b/sweebot.py @@ -658,7 +658,7 @@ while True: if content_type in allowedparse: if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + (soup.title.string.rstrip()[:100] if soup.title != None else "[No title provided]"), channel) + multiline("(" + nick + ") " + (" ".join(soup.title.string.splitlines())[:100] if soup.title != None else "[No title provided]"), channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: @@ -676,7 +676,7 @@ while True: if content_type in allowedparse: if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + (soup.title.string.rstrip()[:100] if soup.title != None else "[No title provided]"), channel) + multiline("(" + nick + ") " + (" ".join(soup.title.string.splitlines())[:100] if soup.title != None else "[No title provided]"), channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) else: -- 2.39.5 From ea6a360bb9d1e5d502bd17e85926bbe48a22e048 Mon Sep 17 00:00:00 2001 From: Nova Cat Date: Sun, 8 Dec 2024 22:39:02 -0800 Subject: [PATCH 30/30] Migrating port --- sweebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sweebot.py b/sweebot.py index 0f6413c..b28a759 100644 --- a/sweebot.py +++ b/sweebot.py @@ -204,7 +204,7 @@ class bot_irc: server_irc = "127.0.0.1" # Use 127.0.0.1 for local ZNC -port_irc = 6667 # NO SSL FOR YOU +port_irc = 5000 # NO SSL FOR YOU channel_irc = ["##sweezero"] botnick_irc = environ.get('SBnick') botnickpass_irc =environ.get('SBuser') -- 2.39.5