1
0
Fork 0
forked from swee/MeowNex

Update sweebot.py

This commit is contained in:
Swee 2024-09-22 13:14:17 -07:00
parent 44fd184d95
commit 26464f4e48

View file

@ -4,14 +4,25 @@ __version__ = "0.0.1 patch 4"
import socket import socket
import subprocess import subprocess
from time import sleep, time, ctime from time import sleep, time, ctime
from os import system as ossystem, path, environ, listdir from os import system as ossystem, path, environ, listdir, getcwd
cwd = getcwd()
import re import re
from random import choice, randint as random from random import choice, randint as random
import traceback import traceback
import threading import threading
class config:
def __init__(self):
import sqlite3 import sqlite3
conn = sqlite3.connect("/home/swee/sbirc.db") conn = sqlite3.connect(cwd + "/sbirc.db")
database = conn.cursor() self.database = conn.cursor()
def perms(self, cloak: str):
try:
self.database.execute(f"SELECT * FROM users WHERE username = '{cloak}';")
output = self.database.fetchall()
return output[0][1]
except:
return ''
# Code snippet from my buddy Irish # Code snippet from my buddy Irish
# Define a dictionary to map terminal color codes to IRC color codes # Define a dictionary to map terminal color codes to IRC color codes
color_map = { color_map = {
@ -129,6 +140,7 @@ irc3 = bot_irc()
irc.connect_irc( irc.connect_irc(
server_irc, port_irc, channel_irc, botnick_irc, botpass_irc, botnickpass_irc server_irc, port_irc, channel_irc, botnick_irc, botpass_irc, botnickpass_irc
) )
sbconfig = config()
threes = [":3", ":3c", "uwu", "owo", "/ᐠ。ꞈ。ᐟ\\", "(✿◠‿◠)"] threes = [":3", ":3c", "uwu", "owo", "/ᐠ。ꞈ。ᐟ\\", "(✿◠‿◠)"]
snacks = ["PepperMintHTMLs", "Dice App candies", "SweeCrypt codes", "Windows 11 Bloomberry flavored icecream"] snacks = ["PepperMintHTMLs", "Dice App candies", "SweeCrypt codes", "Windows 11 Bloomberry flavored icecream"]
run = 0 run = 0
@ -138,13 +150,6 @@ times = 0
def update(): def update():
open("/home/swee/run.txt", 'w').write(str(run)) open("/home/swee/run.txt", 'w').write(str(run))
open("/home/swee/block.txt", 'w').write(str(block)) open("/home/swee/block.txt", 'w').write(str(block))
def getperms(cloak: str):
try:
database.execute("SELECT * FROM users WHERE username = '"+ cloak + "';")
output = database.fetchall()
return output[0][1]
except:
return ''
update() update()
def irci2(): def irci2():
@ -213,7 +218,7 @@ while True:
nick = text.split(" ")[0][1:].split("!")[0] nick = text.split(" ")[0][1:].split("!")[0]
username = text.split(" ")[0][1:].split("@")[1] username = text.split(" ")[0][1:].split("@")[1]
try: try:
perms = getperms(username) perms = config.perms(username)
except: except:
perms = "" perms = ""
print(command) print(command)
@ -267,7 +272,10 @@ while True:
elif command[0] == "$perms": elif command[0] == "$perms":
if len(command) == 2: if len(command) == 2:
irc.send_irc(channel, nick + ": permissions of cloak " + command[1] + ": " + getperms(command[1])) if config.perms(command[1]) != "":
irc.send_irc(channel, nick + ": permissions of cloak " + command[1] + ": " + config.perms(command[1]))
else:
irc.send_irc(channel, nick + ": The cloak " + command[1] + " Doesn't have permissions.")
else: else:
if perms != "": if perms != "":
irc.send_irc(channel, nick + ": " + perms) irc.send_irc(channel, nick + ": " + perms)