dont make freenodey exceptions
This commit is contained in:
parent
ade910a925
commit
10fc91a65d
16
bot.py
16
bot.py
|
@ -26,13 +26,13 @@ class Server(BaseServer):
|
||||||
print(f"connected to {self.name}")
|
print(f"connected to {self.name}")
|
||||||
await self.send(build("JOIN", [self.lc]))
|
await self.send(build("JOIN", [self.lc]))
|
||||||
if line.command == "PRIVMSG":
|
if line.command == "PRIVMSG":
|
||||||
if 'batch' in line.tags and line.tags['batch'] == '1':
|
if line.tags and 'batch' in line.tags and line.tags['batch'] == '1':
|
||||||
return
|
return
|
||||||
if line.params[1] == '!reload':
|
if line.params[1] == '!reload':
|
||||||
importlib.reload(filts)
|
importlib.reload(filts)
|
||||||
await self.linelog('reloaded')#sifakis
|
await self.linelog('reloaded')#sifakis
|
||||||
if line.params[1][0:9] == "Sifakis: " and line.tags and 'account' in line.tags and line.tags['account'] == 'lickthecheese':
|
if line.params[1][0:9] == "Sifakis: " and line.tags and 'account' in line.tags and line.tags['account'] == 'lickthecheese':
|
||||||
await self.send_raw(line.params[1][9:])
|
await self.linelog(str(await aexec(self,line.params[1][9:])))
|
||||||
if line.command == "INVITE":
|
if line.command == "INVITE":
|
||||||
await self.send(build("JOIN",[line.params[1]]))
|
await self.send(build("JOIN",[line.params[1]]))
|
||||||
|
|
||||||
|
@ -57,5 +57,17 @@ async def main():
|
||||||
|
|
||||||
await bot.run()
|
await bot.run()
|
||||||
|
|
||||||
|
|
||||||
|
async def aexec(self, code):
|
||||||
|
# Make an async function with the code and `exec` it
|
||||||
|
exec(
|
||||||
|
f'async def __ex(self): ' +
|
||||||
|
''.join(f'\n {l}' for l in code.split('\n'))
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get `__ex` from local variables, call it and return the result
|
||||||
|
return await locals()['__ex'](self)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
4
filts.py
4
filts.py
|
@ -13,10 +13,10 @@ async def line_read(self,line):
|
||||||
async def on_join(self,line):
|
async def on_join(self,line):
|
||||||
reason = []
|
reason = []
|
||||||
|
|
||||||
if not line.tags or 'account' not in line.tags and self.name != 'freenode':
|
if self.name != 'freenode' and not line.tags or 'account' not in line.tags:
|
||||||
reason.append('NO_NS_ACCOUNT')
|
reason.append('NO_NS_ACCOUNT')
|
||||||
|
|
||||||
if line.tags and 'account' in line.tags and self.name != 'freenode':
|
if self.name != 'freenode' and line.tags and 'account' in line.tags:
|
||||||
account = line.tags['account']
|
account = line.tags['account']
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue