throttle notifs

This commit is contained in:
vulpine 2020-10-20 16:08:15 -04:00
parent f0525a7052
commit b931fa9cf0
1 changed files with 13 additions and 11 deletions

View File

@ -6,25 +6,27 @@ from irctokens import build, Line
async def line_read(self,line):
# line tags command params source
if line.command == "PING" or line.command == "001":
self.jointh = []
if line.command == "JOIN":
await on_join(self,line)
async def on_join(self,line):
reason = []
user = self.users[line.source.split('!')[0].lower()]
if not user.account:
if self.name != 'freenode':
reason.append('NO_NS_ACCOUNT')
nick = line.source.split('!')[0].lower()
if nick in self.jointh:
return
else:
account = user.account
self.jointh.append(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'NS_ACCOUNT ({ac})' for ac in ['lickthecheese'] if ac == account]
host = line.source.split('@')[1]
reason += [f'BAD_HOST ({host})' for ac in ['hot-chilli'] if ac in host]
reason += [f'BAD_HOST ({host}) (chilli xmpp bridge)' for ac in ['hot-chilli'] if ac in host]
if len(reason) > 0:
await self.linelog(f'{line.source} caught in {line.params[0]} because of {", ".join(reason)}')