mirror of
https://github.com/a-bad-dev/irc2bash.git
synced 2026-06-09 08:56:31 +00:00
Generalize some info and allow for a list of bot oppers
This commit is contained in:
parent
fe6727c3c1
commit
fdb305e822
1 changed files with 4 additions and 3 deletions
7
main.py
7
main.py
|
|
@ -11,11 +11,12 @@ import queue
|
|||
class Server():
|
||||
# Setup the IRC related things such as user details and prefixes
|
||||
# This function also sets up the threading events and queues
|
||||
def __init__(self, realname, nickname, channel, command_prefix = "$!", bot_prefix = "$$"):
|
||||
def __init__(self, realname, nickname, channel, command_prefix = "$!", bot_prefix = "$$", opper_nicknames = []):
|
||||
print(f"[SERVER/MAINTHREAD] Using Server() on Python3 PID {os.getpid()}")
|
||||
self.realname = realname
|
||||
self.nickname = nickname
|
||||
self.channel = channel
|
||||
self.opper_nicknames = opper_nicknames
|
||||
|
||||
# Prefix for commands to execute
|
||||
self.command_prefix = command_prefix
|
||||
|
|
@ -261,7 +262,7 @@ class Server():
|
|||
if msg["command"] == "INVITE":
|
||||
msg_source = msg["params"][0]
|
||||
source_user = msg["prefix"].partition("!~")[0]
|
||||
if source_user == "jcjordyn120":
|
||||
if source_user in self.opper_nicknames:
|
||||
print(f"[RECVTHREAD] Joining channel by user command!")
|
||||
self._msg_q.put(f"JOIN {msg['params'][-1]}\r\n".encode())
|
||||
|
||||
|
|
@ -310,7 +311,7 @@ class Server():
|
|||
self._msg_q.put(f"PRIVMSG {source_channel} :CMD {cmd} exited with returncode {proc.returncode}\r\n".encode())
|
||||
|
||||
if __name__ == "__main__":
|
||||
serv = Server("RCE", "rce-is-fun-jcj", "##jcj2")
|
||||
serv = Server("username", "nickname", "##channel", opper_nicknames = ["opperhere"])
|
||||
serv.connect("tantalum.libera.chat", 6667, sock_recvbuf = 8192)
|
||||
|
||||
# Allow for the user to send raw IRC messages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue