dont require prefix in pms
This commit is contained in:
parent
a4581a462d
commit
32a5c4c1aa
3 changed files with 18 additions and 7 deletions
20
bot.py
20
bot.py
|
@ -7,7 +7,7 @@ from ircrobots import Bot as BaseBot
|
|||
from ircrobots import Server as BaseServer
|
||||
from ircrobots import ConnectionParams, SASLUserPass, SASLSCRAM
|
||||
|
||||
from auth import username, password
|
||||
from auth import username, password, channel
|
||||
import shared
|
||||
|
||||
def is_admin(func):
|
||||
|
@ -49,14 +49,14 @@ async def message(self,modname,channel,msg):
|
|||
|
||||
class Server(BaseServer):
|
||||
async def line_read(self, line: Line):
|
||||
print(f"{self.name} < {line.format()}")
|
||||
if 'on_'+line.command.lower() in dir(self):
|
||||
asyncio.create_task(self.__getattribute__('on_'+line.command.lower())(line))
|
||||
for listener in shared.listeners:
|
||||
if listener[0] == line.command:
|
||||
asyncio.create_task(listener[1](self,line))
|
||||
|
||||
async def line_send(self, line: Line):
|
||||
def line_preread(self, line: Line):
|
||||
print(f"{self.name} < {line.format()}")
|
||||
def line_presend(self, line: Line):
|
||||
print(f"{self.name} > {line.format()}")
|
||||
|
||||
|
||||
|
@ -124,9 +124,19 @@ async def main():
|
|||
host = "irc.libera.chat",
|
||||
port = 6697,
|
||||
tls = True,
|
||||
sasl = sasl_params)
|
||||
sasl = sasl_params,
|
||||
autojoin = channel)
|
||||
|
||||
await bot.add_server("libera", params)
|
||||
|
||||
params = ConnectionParams(
|
||||
"min",
|
||||
host = "einstein.sturtz.cf",
|
||||
port = 6667,
|
||||
tls = False,
|
||||
autojoin = ['#sturtz_network'])
|
||||
|
||||
await bot.add_server("sturtz", params)
|
||||
await bot.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -84,6 +84,8 @@ async def filter(self, c, n, m):
|
|||
elif m[:4] == 'min ':
|
||||
m = m[4:]
|
||||
await go(self, c, n, m)
|
||||
elif '#' not in c and n != self.nickname:
|
||||
await go(self, c, n, m)
|
||||
else:
|
||||
if len(m.split(' ')) > 1:
|
||||
if shared.learntime + shared.learndelay < time.time():
|
||||
|
|
|
@ -10,6 +10,5 @@ async def testy(self,channel,nick,msg):
|
|||
|
||||
|
||||
async def init(self):
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue