Compare commits
3 Commits
1019e37470
...
32a5c4c1aa
Author | SHA1 | Date |
---|---|---|
xfnw | 32a5c4c1aa | |
xfnw | a4581a462d | |
xfnw | 5580b3fa86 |
|
@ -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
26
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()}")
|
||||
|
||||
|
||||
|
@ -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__":
|
||||
|
|
10
kim.service
10
kim.service
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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():
|
||||
|
|
|
@ -10,7 +10,5 @@ async def testy(self,channel,nick,msg):
|
|||
|
||||
|
||||
async def init(self):
|
||||
|
||||
await self.send_raw("join #bots")
|
||||
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue