Formatting, remove unprintable
This commit is contained in:
parent
61f81f1fe7
commit
c844c8192c
2 changed files with 15 additions and 4 deletions
2
core.py
2
core.py
|
@ -15,7 +15,7 @@ threads = {}
|
||||||
servers = [
|
servers = [
|
||||||
"ircnow",
|
"ircnow",
|
||||||
"replirc",
|
"replirc",
|
||||||
#"efnet",
|
# "efnet",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
17
ircbot.py
17
ircbot.py
|
@ -13,6 +13,7 @@ class bytes(bbytes):
|
||||||
def lazy_decode(e):
|
def lazy_decode(e):
|
||||||
return str(e)[2:-1]
|
return str(e)[2:-1]
|
||||||
|
|
||||||
|
|
||||||
__version__ = "v1.0.2"
|
__version__ = "v1.0.2"
|
||||||
ircsock = socket(AF_INET, SOCK_STREAM)
|
ircsock = socket(AF_INET, SOCK_STREAM)
|
||||||
botnick = "FireBot"
|
botnick = "FireBot"
|
||||||
|
@ -127,13 +128,22 @@ def ping(ircmsg):
|
||||||
|
|
||||||
|
|
||||||
def sendmsg(msg, target):
|
def sendmsg(msg, target):
|
||||||
print(f"[LOG][{server}] Sending {bytes(msg.encode()).lazy_decode()} to {target}")
|
if target != "NickServ" and not mfind(msg, ["IDENTIFY"], False):
|
||||||
|
print(
|
||||||
|
f"[LOG][{server}] Sending {bytes(msg.encode()).lazy_decode()} to {target}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
print(f"[LOG][{server}] Identifying myself...")
|
||||||
ircsock.send(bytes(f"PRIVMSG {target} :{msg}\n", e))
|
ircsock.send(bytes(f"PRIVMSG {target} :{msg}\n", e))
|
||||||
|
|
||||||
|
|
||||||
def notice(msg, target):
|
def notice(msg, target):
|
||||||
print(f"[LOG][{server}] Sending {bytes(msg.encode()).lazy_decode()} to {target} (NOTICE)")
|
print(
|
||||||
|
f"[LOG][{server}] Sending {bytes(msg.encode()).lazy_decode()} to {target} (NOTICE)"
|
||||||
|
)
|
||||||
ircsock.send(bytes(f"NOTICE {target} :{msg}\n", e))
|
ircsock.send(bytes(f"NOTICE {target} :{msg}\n", e))
|
||||||
|
|
||||||
|
|
||||||
def joinchan(chan: str, origin: str, chanList: dict, lock: bool = True):
|
def joinchan(chan: str, origin: str, chanList: dict, lock: bool = True):
|
||||||
chan = chan.replace(" ", "")
|
chan = chan.replace(" ", "")
|
||||||
if "," in chan:
|
if "," in chan:
|
||||||
|
@ -339,8 +349,9 @@ def main():
|
||||||
else:
|
else:
|
||||||
sendmsg("Access Denied", chan)
|
sendmsg("Access Denied", chan)
|
||||||
elif np.search(message):
|
elif np.search(message):
|
||||||
|
x02 = '\x02'
|
||||||
sendmsg(
|
sendmsg(
|
||||||
f"f.sp {message.split(':')[1].split('(')[0].strip(' ')}", chan
|
f"f.sp {message.split(':')[1].split('(')[0].strip(f' {x02}')}", chan
|
||||||
)
|
)
|
||||||
elif message == "\x01VERSION\x01":
|
elif message == "\x01VERSION\x01":
|
||||||
notice(f"\x01VERSION FireBot {__version__}\x01", name)
|
notice(f"\x01VERSION FireBot {__version__}\x01", name)
|
||||||
|
|
Loading…
Reference in a new issue