Compare commits

...

3 Commits

Author SHA1 Message Date
xfnw 32a5c4c1aa dont require prefix in pms 2021-05-22 16:51:55 -04:00
xfnw a4581a462d dont join 2021-05-21 18:46:30 -04:00
xfnw 5580b3fa86 rename to min because someone registered it on libera smh 2021-05-21 18:44:18 -04:00
9 changed files with 35 additions and 36 deletions

View File

@ -1,4 +1,4 @@
# Kim
# min
A bot that uses weighted topic identifiers, and markov to make intresting and amusing conversations.
Based on the the idea of [RealAI](https://github.com/oblivionburn/RealAI), however it does not use any

26
bot.py
View File

@ -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()}")
@ -120,13 +120,23 @@ async def main():
sasl_params = SASLUserPass(username, password)
params = ConnectionParams(
"kim",
host = "irc.tilde.chat",
"min",
host = "irc.libera.chat",
port = 6697,
tls = True,
sasl = sasl_params)
sasl = sasl_params,
autojoin = channel)
await bot.add_server("tilde", params)
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__":

View File

@ -1,10 +0,0 @@
[Unit]
Description=kim
[Service]
ExecStart=/bin/sh -c 'cd /home/xfnw/kim-irc/; PYTHONUNBUFFERED=1 ./bot.py'
[Install]
WantedBy=default.target

10
min.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=min
[Service]
ExecStart=/bin/sh -c 'cd /home/xfnw/min-irc/; PYTHONUNBUFFERED=1 ./bot.py'
[Install]
WantedBy=default.target

View File

@ -176,7 +176,7 @@ async def adminHandle(self, chan, source, msg):
async def init(self):
self.chandb = shared.db['chan']
self.admins = ['lickthecheese']
self.admins = ['xfnw']
return
self.cmd['admin'] = adminHandle

View File

@ -1,11 +0,0 @@
from bot import *
@rawm('botlist')
async def botlist(self,channel,nick,msg):
if msg == '!botlist':
await message(self,'botlist',channel,'Hi, im kim. im a machine learning chatbot')
async def init(self):
pass

View File

@ -81,9 +81,11 @@ async def filter(self, c, n, m):
if m[:len(shared.prefix)] == shared.prefix:
m = m[len(shared.prefix):]
await go(self, c, n, m)
elif m[:4] == 'kim ':
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():

View File

@ -10,7 +10,5 @@ async def testy(self,channel,nick,msg):
async def init(self):
await self.send_raw("join #bots")
pass

View File

@ -1,7 +1,7 @@
import dataset
prefix = 'kim: '
prefix = 'min: '
modules = {}
listeners = []
commands = {}