diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | Unsetmode.py | 12 | ||||
-rwxr-xr-x | YesServ.py | 42 | ||||
-rwxr-xr-x | cs2libera.py | 54 | ||||
-rwxr-xr-x | librespeech.py | 188 | ||||
-rwxr-xr-x | tourettes.py | 101 |
6 files changed, 218 insertions, 180 deletions
@@ -1,2 +1,3 @@ __pycache__ config.py +ident diff --git a/Unsetmode.py b/Unsetmode.py index 5ef26c3..80d8ac8 100755 --- a/Unsetmode.py +++ b/Unsetmode.py @@ -9,16 +9,10 @@ from miniirc_extras import utils # Add their hostmask here trusted = { - "LibreIRC/staff/Andrew", - "services.irc.andrewyu.org", "andrewyu.org", - "user/labrador", - "services.libera.chat", - "user/AndrewYu", - "user/AndrewYu/bot/LibreBot", - "xIRC/guest/2s1.ocj.4nc5dk.IP", + "user/Lareina", } -banned = {"114.88.181.238"} +banned = {"fases/developer/funderscore"} trusted = set([i.lower() for i in trusted]) banned = set([i.lower() for i in banned]) @@ -44,7 +38,7 @@ def _handle_join(irc, hostmask, args): except KeyError: return if irc.current_nick not in chan.modes.getset("o"): - irc.msg("LibreBot", "OP", chan.name) + irc.msg("ChanServ", "OP", chan.name) else: irc.send("KICK", args[0], hostmask[0], "Channel is locked") @@ -11,20 +11,11 @@ from miniirc_extras import utils # Add their hostmask here trusted = { - "user/luk3yx/bot/lurk", - "user/luk3yx", - "LibreIRC/staff/Andrew", - "services.irc.andrewyu.org", "andrewyu.org", - "user/labrador", "services.libera.chat", - "user/AndrewYu", - "user/AndrewYu/bot/LibreBot", - "xIRC/guest/2s1.ocj.4nc5dk.IP", - "116.230.91.215", - "47.241.24.30", + "user/Lareina", } -banned = {"114.88.181.238"} +banned = {"fases/developer/funderscore"} trusted = set([i.lower() for i in trusted]) banned = set([i.lower() for i in banned]) @@ -42,7 +33,7 @@ def _handle_join(irc, hostmask, args): except KeyError: return if irc.current_nick not in chan.modes.getset("o"): - irc.msg("LibreBot", "OP", chan.name) + irc.msg("ChanServ", "OP", chan.name) elif hostmask[2].lower() in trusted: # Give ops ops if possible try: @@ -55,7 +46,7 @@ def _handle_join(irc, hostmask, args): else: irc.msg( chan.name, - "Welcome back, " + hostmask[0] + "! Glad to see you again!", + "Hi " + hostmask[0] ) elif hostmask[2] in banned: # lets kickban them @@ -185,14 +176,23 @@ def _handle_kick(irc, hostmask, args): irc.msg("LibreBot", "OP " + args[0] + " " + irc.current_nick) irc.msg( args[0], - f"Hey {' '.join(irc.chans[args[0]].modes.getset('o'))}, {hostmask[0]} yaykicked me!", + hostmask[0]+ f": HOW DARE YOU", ) - ops = irc.chans[args[0]].modes.getset("o") - print("@@@", ops) - for op in ops: - if op == irc.current_nick: - continue - irc.send("MODE", args[0], "-o", op) + irc.send("MODE", args[0], "-o", hostmask[0]) + irc.send("MODE", args[0], "+b", "*!*@" + hostmask[2]) + irc.send( + "KICK", + args[0], + hostmask[0], + "Eat jet engines!" + ) + # ops = irc.chans[args[0]].modes.getset("o") + +# print("@@@", ops) +# for op in ops: +# if op == irc.current_nick: +# continue +# irc.send("MODE", args[0], "-o", op) return user = irc.users[args[1]] @@ -289,7 +289,7 @@ def _handle_privmsg(irc, hostmask, args): except KeyError: irc.msg( args[0], - "I don't know who that is, maybe let perse message me? Or is this a permban in the database?", + "I don't know who that is, maybe let them message me? Or is this a permban in the database?", ) else: irc.msg(args[0], f"Invalid command: {cmd}.") diff --git a/cs2libera.py b/cs2libera.py index 83ac64d..0fd8b50 100755 --- a/cs2libera.py +++ b/cs2libera.py @@ -1,15 +1,15 @@ ip = "irc.libera.chat" port = 6697 -nick = "ChanGuard" +nick = "Elestren" ident = nick realname = "git://git.andrewyu.org/ircbots" -identity = open("idents").read() +identity = "Elestren Ww7Ot9uqpSVuOHPNJ12zHsjoAy7P5ReXpUyL7TyRypkN31l38FjsLob0rLb9J3o8" debug = True -channels = ["#librespeech", "##libresociety", "#fsi"] +channels = ["#librespeech"] prefix = "?" chandata = { "#librespeech": { - "werdnA!andrew@andrewyu.org": { + "Lareina!andrew@user/Lareina": { "ban", "op", "autoop", @@ -19,50 +19,6 @@ chandata = { "exempt", "quiet", }, - "Andrew!Andrew@user/AndrewYu": { - "ban", - "op", - "autoop", - "flags", - "invite", - "voice", - "exempt", - "quiet", - }, - "leah!~leah@libreboot/developer/leah": { - "ban", - "op", - "autoop", - "flags", - "invite", - "voice", - "exempt", - "quiet", - }, - }, - "#fsi": { - "Andrew!Andrew@user/AndrewYu": { - "ban", - "op", - "autoop", - "flags", - "invite", - "voice", - "exempt", - "quiet", - } - }, - "##libresociety": { - "Andrew!Andrew@user/AndrewYu": { - "ban", - "op", - "autoop", - "flags", - "invite", - "voice", - "exempt", - "quiet", - } }, } -chaneww = {"#librespeech": {}, "#fsi": {}, "##libresociety": {}} +chaneww = {"#librespeech": {}} diff --git a/librespeech.py b/librespeech.py new file mode 100755 index 0000000..f57663d --- /dev/null +++ b/librespeech.py @@ -0,0 +1,188 @@ +#!/usr/bin/python3 + +""" +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +""" + +import miniirc, sys +import time +from miniirc import * +from miniirc_extras import * + +expire = [0] +assert miniirc.ver >= (1, 4, 0), "This bot requires miniirc >= v1.4.0." + +# Variables +nick = "lbsp" +haxxorname = "qeeg" +badwords = ["balls", "cunt", "wordington", "kill yourself"] +ident = nick +realname = "Censorship" +identity = None +# identity = '<username> <password>' +identity = open("ident").read().strip() +debug = True +channels = ["#librespeech"] +owner = ["Lareina", "f_", "leah", "Noisytoot", "Cindy", "ggoes"] +defcon = [0] + +raiding = [False] + +ip = "irc.libera.chat" +port = 6697 + +# Welcome! +print("Welcome to {}!".format(nick), file=sys.stderr) +irc = IRC( + ip, + port, + nick, + channels, + ident=ident, + realname=realname, + ns_identity=identity, + debug=debug, + auto_connect=False, +) + +topic = ["Librespeech | bot testing"] + +def trans(s): + if s == "+": return "-" + if s == "-": return "+" + return s +@irc.Handler("KICK", colon=False) +def yay(irc, hostmask, args): + channel = args[0] + text = args[-1] + t = text.lower() + if args[1] != irc.current_nick: + return + irc.msg( + "ChanServ", + "UNBAN", + channel + ) + irc.send("JOIN", channel) + if not defcon[0]: return + if hostmask[0] != haxxorname: + return + irc.msg("ChanServ", "DEOP", channel, haxxorname) + irc.send("KICK", channel, haxxorname, "retaliation") +@irc.Handler("JOIN", colon=False) +def yay(irc, hostmask, args): + channel = args[0] + if hostmask[0] == irc.current_nick: + if defcon[0]: irc.msg("ChanServ", "DEOP", channel, haxxorname) + irc.msg("ChanServ", "OP", channel) + elif not defcon[0]: return + elif hostmask[0] == haxxorname: + if defcon[0] == 1: + irc.notice(haxxorname, f"[{channel}] You are not allowed to op up, change the topic, set modes, or do any similar thing in this channel.") + if defcon[0] == 3: + irc.send("MODE", channel, "+q", "$a:%s" % haxxorname) + if defcon[0] >= 4: + irc.send("MODE", channel, "+b", "$a:%s" % haxxorname) + irc.send("KICK", channel, haxxorname, "You're banned!") + else: + irc.notice(hostmask[0], f"[{channel}] Welcome to the channel! Please keep an eye on {haxxorname} to make sure they don't do anything evil.") +@irc.Handler("PRIVMSG", colon=False) +def yay(irc, hostmask, args): + channel = args[0] + if hostmask[0] == "LitBot" and "・゜゜・。。・゜゜\_o< QUACK!" == args[-1].strip(): + irc.msg(channel, "LitBot: bef") + return + elif hostmask[0] == haxxorname and defcon[0] == 2: + text = args[-1].lower().strip() + for each in badwords: + if ' ' + each + ' ' in text or text.startswith(each + " ") or text.endswith(" " + each) or text == each: + irc.send("MODE", channel, "+q", "$a:%s" % haxxorname) + time.sleep(60) + irc.send("MODE", channel, "-q", "$a:%s" % haxxorname) + return + if hostmask[0] in owner and args[-1] == f"{irc.current_nick}: quit": + exit(0) + elif hostmask[0] in owner and args[-1] == f"{irc.current_nick}: off": + defcon[0] = 0 + irc.send("MODE", channel, "-bq", "$a:%s" % haxxorname, "$a:%s" % haxxorname) + irc.msg(channel, f"{hostmask[0]}: defcon 0 set: relax") + elif hostmask[0] in owner and args[-1] == f"{irc.current_nick}: noop": + defcon[0] = 1 + irc.send("MODE", channel, "-bq", "$a:%s" % haxxorname, "$a:%s" % haxxorname) + irc.msg(channel, f"{hostmask[0]}: defcon 1 set: deny channel operator privileges") + elif hostmask[0] in owner and args[-1] == f"{irc.current_nick}: censor": + defcon[0] = 2 + irc.send("MODE", channel, "-bq", "$a:%s" % haxxorname, "$a:%s" % haxxorname) + irc.msg(channel, f"{hostmask[0]}: defcon 2 set: temporary quiet on badwords") + elif hostmask[0] in owner and args[-1] == f"{irc.current_nick}: quiet": + defcon[0] = 3 + irc.send("MODE", channel, "-b+q", "$a:%s" % haxxorname, "$a:%s" % haxxorname) + irc.msg(channel, f"{hostmask[0]}: defcon 3 set: quiet") + elif hostmask[0] in owner and args[-1] == f"{irc.current_nick}: ban": + defcon[0] = 4 + irc.send("MODE", channel, "+bq", "$a:%s" % haxxorname, "$a:%s" % haxxorname) + irc.msg(channel, f"{hostmask[0]}: defcon 4 set: automatic kickban") + elif hostmask[0] in owner and args[-1].startswith(f"{irc.current_nick}:"): + irc.msg(channel, f"{hostmask[0]}: usage: {irc.current_nick} (off | noop | censor | quiet | ban)") + elif args[-1].startswith(f"{irc.current_nick}:") and hostmask[0] == haxxorname: + irc.msg(channel, f"{hostmask[0]}: lmao u serious?") + elif args[-1].startswith(f"{irc.current_nick}:"): + irc.msg(channel, f"{hostmask[0]}: unauthorized") + + +@irc.Handler("MODE", colon=False) +def yay(irc, hostmask, args): + if not defcon[0]: return + channel = args[0] + if args[1] == "-o" and args[2] == irc.current_nick: + irc.msg("ChanServ", "OP", channel) + if args[1] == "+o" and args[2] == haxxorname: + irc.msg("ChanServ", "DEOP", channel, haxxorname) + if hostmask[0] != haxxorname: + return + irc.msg("ChanServ", "OP", channel) + irc.msg("ChanServ", "DEOP", channel, haxxorname) + irc.send("MODE", channel, ''.join([trans(s) for s in args[1]]), *(args[2:])) +@irc.Handler("TOPIC", colon=False) +def yay(irc, hostmask, args): + if not defcon[0]: return + channel = args[0] + text = args[-1] + t = text.lower() + if hostmask[0] != haxxorname: + topic[0] = text + return + irc.msg("ChanServ", "DEOP", channel, haxxorname) + irc.send( + "TOPIC", + channel, + topic[0] + ) +@irc.Handler("474", colon=False) +def yay(irc, hostmask, args): + channel = args[0] + if defcon[0]: + irc.msg("ChanServ", "DEOP", channel, haxxorname) + irc.msg( + "ChanServ", + "UNBAN", + channel + ) + irc.send("JOIN", channel) + + +if __name__ == "__main__": + irc.require("users") + irc.require("chans") + irc.connect() diff --git a/tourettes.py b/tourettes.py deleted file mode 100755 index 917e278..0000000 --- a/tourettes.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/python3 - -""" -No tourettes triggering allowed. - -The original base of this program is available at -https://github.com/luk3yx/stdinbot, under the Expat license. However, -more than 95% has been written differently. All changes are under -the following waiver: - -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to <http://unlicense.org/> -""" - -import miniirc, sys -import time -from miniirc import * -from miniirc_extras import * - -assert miniirc.ver >= (1, 4, 0), "This bot requires miniirc >= v1.4.0." - -# Variables -nick = "tourettes" -ident = nick -realname = "just a bot for qeeg" -identity = None -# identity = '<username> <password>' -debug = True -channels = ["#librespeech", "#libreqeeg"] -owner = "Andrew/AndrewYu <andrew@andrewyu.org>" - -raiding = [False] - -why = {} -for c in channels: - why[c] = owner - -ip = "irc.libera.chat" -port = 6697 - -# Welcome! -print("Welcome to {}!".format(nick), file=sys.stderr) -irc = IRC( - ip, - port, - nick, - channels, - ident=ident, - realname=realname, - ns_identity=identity, - debug=debug, - auto_connect=False, -) - - - -@irc.Handler("PRIVMSG", colon=False) -def handle_privmsg(irc, hostmask, args): - channel = args[0] - if channel.startswith("#"): - ops = irc.chans[channel].modes.getset("o") - c = True - - text = args[-1] - words = args[-1].split(" ") - t = text.lower() - w = [x.lower() for x in words] - print(channel, hostmask, text, words, t, w) - bad = "\x68\x6D\x6D" - if (t.startswith(bad) or " " + bad in t): - print(f"trying to kick {hostmask[0]} from {channel}") - irc.msg( - hostmask[0], - f"[{channel}] Do not use this word (\"hmm\"). A user in this channel has Tourette Syndrome.", - ) -if __name__ == "__main__": - irc.require("users") - irc.require("chans") - irc.connect() |