forked from Firepup650/FireBot
Support for ducking
This commit is contained in:
parent
f5d4071fc2
commit
d7f3db2204
1 changed files with 15 additions and 4 deletions
19
ircbot.py
19
ircbot.py
|
@ -118,16 +118,22 @@ def CTCPHandler(msg: str, sender: str = "", isRaw: bool = False):
|
||||||
f"\x01VERSION FireBot {__version__} (https://git.amcforum.wiki/Firepup650/fire-ircbot)\x01",
|
f"\x01VERSION FireBot {__version__} (https://git.amcforum.wiki/Firepup650/fire-ircbot)\x01",
|
||||||
sender,
|
sender,
|
||||||
)
|
)
|
||||||
|
return True
|
||||||
elif CTCP == "USERINFO":
|
elif CTCP == "USERINFO":
|
||||||
notice("\x01USERINFO FireBot (Firepup's bot)\x01", sender)
|
notice("\x01USERINFO FireBot (Firepup's bot)\x01", sender)
|
||||||
|
return True
|
||||||
elif CTCP == "SOURCE":
|
elif CTCP == "SOURCE":
|
||||||
notice(
|
notice(
|
||||||
"\x01SOURCE https://git.amcforum.wiki/Firepup650/fire-ircbot\x01", sender
|
"\x01SOURCE https://git.amcforum.wiki/Firepup650/fire-ircbot\x01", sender
|
||||||
)
|
)
|
||||||
|
return True
|
||||||
elif CTCP == "FINGER":
|
elif CTCP == "FINGER":
|
||||||
notice(f"\x01FINGER Firepup's bot\x01", sender)
|
notice(f"\x01FINGER Firepup's bot\x01", sender)
|
||||||
|
return True
|
||||||
elif CTCP == "CLIENTINFO":
|
elif CTCP == "CLIENTINFO":
|
||||||
notice(f"\x01CLIENTINFO ACTION VERSION USERINFO SOURCE FINGER", sender)
|
notice(f"\x01CLIENTINFO ACTION VERSION USERINFO SOURCE FINGER", sender)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def joinserver():
|
def joinserver():
|
||||||
|
@ -355,7 +361,7 @@ def main():
|
||||||
):
|
):
|
||||||
for i in channels:
|
for i in channels:
|
||||||
sendmsg("Rebooting...", i)
|
sendmsg("Rebooting...", i)
|
||||||
ircsock.send(bytes("QUIT\n", e))
|
ircsock.send(bytes("QUIT :Rebooting\n", e))
|
||||||
__import__("os").system("python3 -u ircbot.py")
|
__import__("os").system("python3 -u ircbot.py")
|
||||||
exit(f"[EXIT][{server}] Inner layer exited or crashed")
|
exit(f"[EXIT][{server}] Inner layer exited or crashed")
|
||||||
elif (
|
elif (
|
||||||
|
@ -366,9 +372,9 @@ def main():
|
||||||
# print(f'[LOG][{server}] i="{i}" vs chan="{chan}"')
|
# print(f'[LOG][{server}] i="{i}" vs chan="{chan}"')
|
||||||
if i != chan.strip():
|
if i != chan.strip():
|
||||||
sendmsg("goodbye... :'(", i)
|
sendmsg("goodbye... :'(", i)
|
||||||
ircsock.send(bytes("QUIT \n", "UTF-8"))
|
ircsock.send(bytes("QUIT :Shutting down\n", "UTF-8"))
|
||||||
print(f"[LOG][{server}] QUIT")
|
print(f"[LOG][{server}] QUIT")
|
||||||
exit(f"[EXIT][{server}] goodbye ;'(")
|
exit(f"[EXIT][{server}] goodbye :'(")
|
||||||
# raise EOFError
|
# raise EOFError
|
||||||
elif sucheck(message):
|
elif sucheck(message):
|
||||||
if name.lower() in adminnames:
|
if name.lower() in adminnames:
|
||||||
|
@ -384,7 +390,12 @@ def main():
|
||||||
chan,
|
chan,
|
||||||
)
|
)
|
||||||
elif len(message.split("\x01")) == 3:
|
elif len(message.split("\x01")) == 3:
|
||||||
CTCPHandler(message, name)
|
if not CTCPHandler(message, name):
|
||||||
|
CTCP = message.split("\x01")[1]
|
||||||
|
if CTCP == "ACTION ducks":
|
||||||
|
sendmsg("\x01ACTION gets hit by a duck\x01", chan)
|
||||||
|
elif CTCP.startswith("ACTION ducks"):
|
||||||
|
sendmsg(f"\x01ACTION gets hit by {CTCP.split(' ', 2)[2]}\x01", chan)
|
||||||
if chan in channels and channels[chan] >= interval:
|
if chan in channels and channels[chan] >= interval:
|
||||||
r.seed()
|
r.seed()
|
||||||
channels[chan] = 0
|
channels[chan] = 0
|
||||||
|
|
Loading…
Reference in a new issue