chaotic lol
This commit is contained in:
parent
b931fa9cf0
commit
33036cb4bb
4
bot.py
4
bot.py
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
logchan = "#xfnwtest"
|
||||
logchan = "#chaos"
|
||||
|
||||
|
||||
import asyncio, importlib
|
||||
|
@ -14,7 +14,7 @@ from ircrobots import ConnectionParams, SASLUserPass, SASLSCRAM
|
|||
import filts, auth
|
||||
|
||||
SERVERS = [
|
||||
("freenode", "chat.freenode.net"),
|
||||
#("freenode", "chat.freenode.net"),
|
||||
("tilde","irc.tilde.chat"),
|
||||
]
|
||||
|
||||
|
|
59
filts.py
59
filts.py
|
@ -1,4 +1,8 @@
|
|||
|
||||
M = 60
|
||||
H = 60*M
|
||||
D = 24 * H
|
||||
|
||||
import asyncio
|
||||
|
||||
from irctokens import build, Line
|
||||
|
@ -8,30 +12,63 @@ async def line_read(self,line):
|
|||
# line tags command params source
|
||||
if line.command == "PING" or line.command == "001":
|
||||
self.jointh = []
|
||||
self.tomode=""
|
||||
if line.command == "482":
|
||||
await self.send(build("cs",["owner","#chaos"]))
|
||||
if line.command == "JOIN":
|
||||
await on_join(self,line)
|
||||
if line.command == "MODE":
|
||||
await on_mode(self,line)
|
||||
if line.command == "KICK":
|
||||
await on_kick(self,line)
|
||||
|
||||
async def on_kick(self,line):
|
||||
if (
|
||||
line.params[0] == '#chaos' and
|
||||
line.params[1] == self.nickname
|
||||
):
|
||||
await self.send(build("cs",["invite",line.params[0]]))
|
||||
|
||||
|
||||
async def awpop(obj,item):
|
||||
await asyncio.sleep(1*M)
|
||||
obj.pop(item)
|
||||
|
||||
async def on_join(self,line):
|
||||
nick = line.source.split('!')[0].lower()
|
||||
if nick in self.jointh:
|
||||
return
|
||||
else:
|
||||
self.jointh.append(nick)
|
||||
#if nick in self.jointh:
|
||||
# return
|
||||
#else:
|
||||
# asyncio.create_task(awpop(self.jointh,len(self.jointh)))
|
||||
# self.jointh.append(nick)
|
||||
|
||||
async def checkUser(self,nick):
|
||||
reason = []
|
||||
user = self.users[nick]
|
||||
|
||||
reason += [f'NS_ACCOUNT ({ac}) (yeen yeen yeen)' for ac in ['yeenis'] if ac == user.account]
|
||||
|
||||
reason += [f'BAD_REALNAME ({user.realname}) (gore spammer?)' for ac in ['kendo'] if ac in user.realname]
|
||||
reason += [f'BAD_NICK ({nick}) (malicious robot)' for ac in ['war'] if ac in nick]
|
||||
reason += [f'NS_ACCOUNT ({ac}) (Kied)' for ac in ['kiedtl','yeenkuus'] if ac == user.account]
|
||||
|
||||
host = line.source.split('@')[1]
|
||||
reason += [f'BAD_HOST ({host}) (chilli xmpp bridge)' for ac in ['hot-chilli'] if ac in host]
|
||||
reason += [f'BAD_REALNAME ({user.realname}) (Kied)' for ac in ['kiedtl'] if ac in user.realname]
|
||||
|
||||
reason += [f'BAD_USERNAME ({user.username}) (Kied)' for ac in ['kiedtl','spacehare'] if ac in user.username]
|
||||
reason += [f'BAD_HOSTNAME ({user.hostname}) (Open Proxy)' for ac in ['chilli','harris.team'] if ac in user.hostname]
|
||||
|
||||
if len(reason) > 0:
|
||||
await self.linelog(f'{line.source} caught in {line.params[0]} because of {", ".join(reason)}')
|
||||
|
||||
self.tomode = nick
|
||||
await self.send(build("MODE",["#chaos","-qocunt",nick,nick]))
|
||||
await self.linelog(f'{nick} caught because of {", ".join(reason)}')
|
||||
|
||||
|
||||
async def on_mode(self,line):
|
||||
if self.nickname in line.source:
|
||||
return
|
||||
if line.params == ["#chaos","+q",self.nickname]:
|
||||
self.send("MODE",["#chaos","-qocunt",self.tomode,self.tomode])
|
||||
for i in set(line.params[2:]):
|
||||
nick = i.lower()
|
||||
if nick in self.channels[line.params[0]].users:
|
||||
await checkUser(self,nick)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue