commit 1f4848887bfc21bb9cdee5e746518514a88a73ce
parent 66299849138fd08413154a80449df93a96595eda
Author: xfnw <xfnw@ttm.sh>
Date: Fri, 22 Jan 2021 15:56:58 -0500
do not propogate pings for people on the NOPING list
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/bot.py b/bot.py
@@ -59,6 +59,11 @@ class Server(BaseServer):
for i in random.sample(list(self.bot.servers),len(self.bot.servers)):
asyncio.create_task(self.bot.servers[i].ac(self.name,args))
return
+ for npn in NOPING:
+ offset = 1
+ for loc in find_all_indexes(text.lower(), npn.lower()):
+ text = text[:loc+offset]+"\u200c"+text[loc+offset:]
+ offset += 1
for i in random.sample(list(self.bot.servers),len(self.bot.servers)):
asyncio.create_task(self.bot.servers[i].bc(self.name,nick,text))
#await self.send(build("PRIVMSG ##xfnw :ine and boat ",[text]))
@@ -90,6 +95,22 @@ class Bot(BaseBot):
def create_server(self, name: str):
return Server(self, name)
+
+
+def find_all_indexes(input_str, search_str):
+ l1 = []
+ length = len(input_str)
+ index = 0
+ while index < length:
+ i = input_str.find(search_str, index)
+ if i == -1:
+ return l1
+ l1.append(i)
+ index = i + 1
+ return l1
+
+
+
async def main():
bot = Bot()
for name, host, port, ssl in SERVERS:
diff --git a/config.py.example b/config.py.example
@@ -14,3 +14,5 @@ FNCHANNEL = '##testrelay'
ADMINS=['jess']
+NOPING=['MIF']
+