reformat with black

This commit is contained in:
xfnw 2022-01-26 21:22:42 -05:00
parent ce7f30ac66
commit 3a3519764a
22 changed files with 934 additions and 744 deletions

89
bot.py
View File

@ -10,105 +10,115 @@ from ircrobots import ConnectionParams, SASLUserPass, SASLSCRAM
from auth import username, password
import shared
def is_admin(func):
async def decorator(self,channel,nick,msg):
if nick.lower() in self.users and self.users[nick.lower()].account in self.admins:
await func(self,channel,nick,msg)
async def decorator(self, channel, nick, msg):
if (
nick.lower() in self.users
and self.users[nick.lower()].account in self.admins
):
await func(self, channel, nick, msg)
else:
await message(self,channel,'you do not have permission to do that')
await message(self, channel, "you do not have permission to do that")
return decorator
#def is_chanop(func):
# def is_chanop(func):
def command(commandname):
def decorator(func):
shared.commands[commandname] = func
return func
return decorator
def listener(listenername):
def decorator(func):
shared.listeners.append((listenername, func))
return func
return decorator
def rawm(rname):
def decorator(func):
shared.rawm[rname] = func
return func
return decorator
async def message(self,channel,msg):
async def message(self, channel, msg):
modname = os.path.splitext(os.path.basename(inspect.stack()[1].filename))[0]
await self.send(build("PRIVMSG",[channel,f'[\x036{modname}\x0f] {msg}']))
await self.send(build("PRIVMSG", [channel, f"[\x036{modname}\x0f] {msg}"]))
class Server(BaseServer):
async def line_read(self, line: Line):
if 'on_'+line.command.lower() in dir(self):
asyncio.create_task(self.__getattribute__('on_'+line.command.lower())(line))
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))
asyncio.create_task(listener[1](self, line))
async def line_preread(self, line: Line):
print(f"{self.name} < {line.format()}")
async def line_presend(self, line: Line):
print(f"{self.name} > {line.format()}")
async def on_001(self, line):
asyncio.create_task(self.load_modules())
async def load_modules(self):
for i in [s for s in os.listdir('modules') if '.py' in s and '.swp' not in s]:
for i in [s for s in os.listdir("modules") if ".py" in s and ".swp" not in s]:
i = i[:-3]
m = importlib.import_module('modules.' + i)
m = importlib.import_module("modules." + i)
asyncio.create_task(m.init(self))
shared.modules[i] = m
# depricated, to support old modules
async def message(self,channel,msg):
await self.send(build("PRIVMSG",[channel,msg]))
async def message(self, channel, msg):
await self.send(build("PRIVMSG", [channel, msg]))
async def on_privmsg(self, line):
if line.tags and "batch" in line.tags and line.tags["batch"] == '1':
if line.tags and "batch" in line.tags and line.tags["batch"] == "1":
return
channel = line.params[0]
nick = line.source.split('!')[0]
nick = line.source.split("!")[0]
msg = line.params[1]
if channel == self.nickname:
channel = nick
await self.handle_rawm(channel,nick,msg)
await self.handle_command(channel,nick,msg)
async def handle_rawm(self,channel,nick,msg):
await self.handle_rawm(channel, nick, msg)
await self.handle_command(channel, nick, msg)
async def handle_rawm(self, channel, nick, msg):
for i in shared.rawm:
await shared.rawm[i](self,channel,nick,msg)
async def handle_command(self,channel,nick,msg):
if msg[:len(shared.prefix)] == shared.prefix:
msg = msg[len(shared.prefix):]
cmd = msg.split(' ')[0]
msg = msg[len(cmd)+1:]
await shared.rawm[i](self, channel, nick, msg)
async def handle_command(self, channel, nick, msg):
if msg[: len(shared.prefix)] == shared.prefix:
msg = msg[len(shared.prefix) :]
cmd = msg.split(" ")[0]
msg = msg[len(cmd) + 1 :]
if len(cmd) < 1:
return
if cmd in shared.commands:
await shared.commands[cmd](self,channel,nick,msg)
await shared.commands[cmd](self, channel, nick, msg)
return
results = [i for i in shared.commands if i.startswith(cmd)]
if len(results) == 1:
await shared.commands[results[0]](self,channel,nick,msg)
await shared.commands[results[0]](self, channel, nick, msg)
class Bot(BaseBot):
@ -120,16 +130,13 @@ async def main():
bot = Bot()
sasl_params = SASLUserPass(username, password)
params = ConnectionParams(
"balun",
host = "irc.tilde.chat",
port = 6697,
tls = True,
sasl = sasl_params)
params = ConnectionParams(
"balun", host="irc.tilde.chat", port=6697, tls=True, sasl=sasl_params
)
await bot.add_server("tilde", params)
await bot.run()
if __name__ == "__main__":
asyncio.run(main())

View File

@ -9,9 +9,9 @@ from typing import Dict, List, Optional, Pattern, Tuple
from dataclasses import dataclass
from async_timeout import timeout as timeout_
from OpenSSL import crypto
from OpenSSL import crypto
#from .config import CertPattern
# from .config import CertPattern
@dataclass
@ -20,25 +20,20 @@ class CertPattern(object):
find: List[Pattern]
CERT_KEYS = [
("CN", "cn"),
("O", "on")
]
CERT_KEYS = [("CN", "cn"), ("O", "on")]
TLS = ssl.SSLContext(ssl.PROTOCOL_TLS)
def _bytes_dict(d: List[Tuple[bytes, bytes]]) -> Dict[str, str]:
return {k.decode("utf8"): v.decode("utf8") for k, v in d}
class CertScanner(object):
def __init__(self, timeout: int = 5):
self._timeout = timeout
async def _values(self,
ip: str,
port: int
) -> List[Tuple[str, str]]:
async def _values(self, ip: str, port: int) -> List[Tuple[str, str]]:
reader, writer = await asyncio.open_connection(ip, port, ssl=TLS)
cert = writer.transport._ssl_protocol._sslpipe.ssl_object.getpeercert(True)
writer.close()
@ -47,7 +42,7 @@ class CertScanner(object):
x509 = crypto.load_certificate(crypto.FILETYPE_ASN1, cert)
subject = _bytes_dict(x509.get_subject().get_components())
issuer = _bytes_dict(x509.get_issuer().get_components())
issuer = _bytes_dict(x509.get_issuer().get_components())
values: List[Tuple[str, str]] = []
for cert_key, match_key in CERT_KEYS:
@ -65,18 +60,14 @@ class CertScanner(object):
return values
async def _match(self,
ip: str,
port: int,
certs: List[CertPattern]
) -> Optional[str]:
async def _match(
self, ip: str, port: int, certs: List[CertPattern]
) -> Optional[str]:
try:
async with timeout_(self._timeout):
values_t = await self._values(ip, port)
except (asyncio.TimeoutError,
ConnectionError):
except (asyncio.TimeoutError, ConnectionError):
pass
except Exception as e:
traceback.print_exc()
@ -89,10 +80,7 @@ class CertScanner(object):
return f"{value} (:{port} {cert.name})"
return None
async def scan(self,
ip: str,
bad: Dict[int, List[CertPattern]]
) -> Optional[str]:
async def scan(self, ip: str, bad: Dict[int, List[CertPattern]]) -> Optional[str]:
coros = [self._match(ip, p, c) for p, c in bad.items()]
tasks = set(asyncio.ensure_future(c) for c in coros)
while tasks:
@ -110,4 +98,3 @@ class CertScanner(object):
return result
tasks = set(asyncio.ensure_future(f) for f in unfinished)
return None

View File

@ -1,213 +1,260 @@
import importlib, time, asyncio, random
from bot import *
quitmessages = [
"time to die",
'you can hide, but you can not run!',
"you're next",
'bye',
'the balun has been popped.',
]
"time to die",
"you can hide, but you can not run!",
"you're next",
"bye",
"the balun has been popped.",
]
async def commit(self, chan, source, msg):
await self.quit('{} told me to commit {}'.format(source,msg))
await self.quit("{} told me to commit {}".format(source, msg))
async def quit(self, chan, source, msg):
await self.send(build("QUIT",[random.choice(quitmessages)]))
await self.send(build("QUIT", [random.choice(quitmessages)]))
async def reloadmods(self, chan, source, msg):
await self.message(chan, '[\x036admin\x0f] reloading modules...')
shared.oldcmd = shared.commands
shared.commands = {}
shared.rawm = {}
shared.listeners = []
shared.help = {}
try:
for i in shared.modules:
importlib.reload(shared.modules[i])
await shared.modules[i].init(self)
#await self.message(chan, '[\x036admin\x0f] load {} sucess!'.format(i))
await self.message(chan, '[\x036admin\x0f] done! {} modules reloaded!'.format(len(shared.modules)))
except:
await self.message(chan, '[\x036admin\x0f] reload failed... attempting to recover...')
shared.commands = shared.oldcmd
await self.message(chan, "[\x036admin\x0f] reloading modules...")
shared.oldcmd = shared.commands
shared.commands = {}
shared.rawm = {}
shared.listeners = []
shared.help = {}
try:
for i in shared.modules:
importlib.reload(shared.modules[i])
await shared.modules[i].init(self)
# await self.message(chan, '[\x036admin\x0f] load {} sucess!'.format(i))
await self.message(
chan,
"[\x036admin\x0f] done! {} modules reloaded!".format(len(shared.modules)),
)
except:
await self.message(
chan, "[\x036admin\x0f] reload failed... attempting to recover..."
)
shared.commands = shared.oldcmd
async def rawcmd(self, chan, source, msg):
await self.send_raw(msg)
await self.send_raw(msg)
async def joins(self, chan, source, msg):
await self.message(chan, '[\x036admin\x0f] joining slowly as to not flood...')
for i in self.chandb.all():
await self.send(build("JOIN",[i['name']]))
await asyncio.sleep(1)
print('joined {}'.format(i['name']))
await self.message(chan, '[\x036admin\x0f] Sucess! i may be laggy for a bit while i sort through all these channels...')
await self.message(chan, "[\x036admin\x0f] joining slowly as to not flood...")
for i in self.chandb.all():
await self.send(build("JOIN", [i["name"]]))
await asyncio.sleep(1)
print("joined {}".format(i["name"]))
await self.message(
chan,
"[\x036admin\x0f] Sucess! i may be laggy for a bit while i sort through all these channels...",
)
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'))
)
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)
return await locals()["__ex"](self)
async def ev(self, chan, source, msg):
msg = msg.split(' ')
try:
await self.message(chan, '[\x036admin\x0f] ok, output: {}'.format(
str(await aexec(self, ' '.join(msg)))[:400]
))
except:
await self.message(chan, '[\x036admin\x0f] exception in eval!')
msg = msg.split(" ")
try:
await self.message(
chan,
"[\x036admin\x0f] ok, output: {}".format(
str(await aexec(self, " ".join(msg)))[:400]
),
)
except:
await self.message(chan, "[\x036admin\x0f] exception in eval!")
async def send(self, c, n, m):
msg = m.split(' ')
await self.message(msg.pop(0), ' '.join(msg))
await self.message(c, '[\x036admin\x0f] sent')
msg = m.split(" ")
await self.message(msg.pop(0), " ".join(msg))
await self.message(c, "[\x036admin\x0f] sent")
async def shut(self, c, n, m):
shared.qtime[c] = time.time()+(60*10)
await self.message(c, '[\x036admin\x0f] Ok, il be back in 10 minutes')
shared.qtime[c] = time.time() + (60 * 10)
await self.message(c, "[\x036admin\x0f] Ok, il be back in 10 minutes")
async def schans(self, c, n, m):
self.chandb.delete()
for i in self.channels:
self.chandb.insert(dict(name=i))
await self.message(c, '[\x036admin\x0f] Ok')
self.chandb.delete()
for i in self.channels:
self.chandb.insert(dict(name=i))
await self.message(c, "[\x036admin\x0f] Ok")
async def addalias(self,c,n,m):
al = m.split(' ')[0]
m = m[len(al)+1:] # dont use the list since i want trailing spaces
async def addalias(self, c, n, m):
al = m.split(" ")[0]
m = m[len(al) + 1 :] # dont use the list since i want trailing spaces
if al in self.cmd:
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
await self.message(c, "[\x036admin\x0f] no dont overwrite a command dummy")
return
self.cmd[al]=Alias(m).alias
self.cmd[al] = Alias(m).alias
await self.message(c,'[\x036admin\x0f] added "{}" alias for "{}"'.format(al,m))
await self.message(c, '[\x036admin\x0f] added "{}" alias for "{}"'.format(al, m))
async def addot(self,c,n,m):
al = m.split(' ')[0]
m = m[len(al)+1:] # dont use the list since i want trailing spaces
async def addot(self, c, n, m):
al = m.split(" ")[0]
m = m[len(al) + 1 :] # dont use the list since i want trailing spaces
if al in shared.rawm:
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
await self.message(c, "[\x036admin\x0f] no dont overwrite a command dummy")
return
shared.rawm[al]=Ot(m,al).ot
shared.rawm[al] = Ot(m, al).ot
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
await self.message(c, '[\x036admin\x0f] added "{}" trigger for "{}"'.format(al, m))
async def addspook(self,c,n,m):
al = m.split(' ')[0]
m = m[len(al)+1:] # dont use the list since i want trailing spaces
async def addspook(self, c, n, m):
al = m.split(" ")[0]
m = m[len(al) + 1 :] # dont use the list since i want trailing spaces
if al in shared.rawm:
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
await self.message(c, "[\x036admin\x0f] no dont overwrite a command dummy")
return
shared.rawm[al]=Spook(m,al).spook
shared.rawm[al] = Spook(m, al).spook
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
await self.message(c, '[\x036admin\x0f] added "{}" trigger for "{}"'.format(al, m))
async def addtrigger(self,c,n,m):
al = m.split(' ')[0]
m = m[len(al)+1:] # dont use the list since i want trailing spaces
async def addtrigger(self, c, n, m):
al = m.split(" ")[0]
m = m[len(al) + 1 :] # dont use the list since i want trailing spaces
if al in shared.rawm:
await self.message(c,'[\x036admin\x0f] no dont overwrite a command dummy')
await self.message(c, "[\x036admin\x0f] no dont overwrite a command dummy")
return
shared.rawm[al]=Trigger(m,al).trigger
shared.rawm[al] = Trigger(m, al).trigger
await self.message(c,'[\x036admin\x0f] added "{}" trigger for "{}"'.format(al,m))
await self.message(c, '[\x036admin\x0f] added "{}" trigger for "{}"'.format(al, m))
class Ot():
class Ot:
def __init__(self, ms, al):
self.ms = str(ms)
self.al = str(al)
async def ot(alself,self,c,n,m):
async def ot(alself, self, c, n, m):
if alself.al in m and n != self.nickname:
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
asyncio.create_task(
self.on_privmsg(
build("PRIVMSG", [c, alself.ms.format(m)], n + "!spoof@spoof")
)
)
shared.rawm.pop(alself.al)
class Spook():
class Spook:
def __init__(self, ms, al):
self.ms = str(ms)
self.al = str(al)
async def spook(alself,self,c,n,m):
async def spook(alself, self, c, n, m):
if alself.al in m and n != self.nickname:
asyncio.create_task(self.message(c,alself.ms.format(m)))
asyncio.create_task(self.message(c, alself.ms.format(m)))
shared.rawm.pop(alself.al)
class Trigger():
class Trigger:
def __init__(self, ms, al):
self.ms = str(ms)
self.al = str(al)
async def trigger(alself,self,c,n,m):
async def trigger(alself, self, c, n, m):
if alself.al in m:
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
asyncio.create_task(
self.on_privmsg(
build("PRIVMSG", [c, alself.ms.format(m)], n + "!spoof@spoof")
)
)
class Alias():
class Alias:
def __init__(self, ms):
self.ms = str(ms)
async def alias(alself,self,c,n,m):
asyncio.create_task(self.on_privmsg(build("PRIVMSG",[c,alself.ms.format(m)],n+'!spoof@spoof')))
async def alias(alself, self, c, n, m):
asyncio.create_task(
self.on_privmsg(
build("PRIVMSG", [c, alself.ms.format(m)], n + "!spoof@spoof")
)
)
commands = {
'quit': quit,
'reload': reloadmods,
'commit': commit,
'raw': rawcmd,
'eval': ev,
'send': send,
'joins': joins,
'shut': shut,
'schans': schans,
'addalias': addalias,
'addtrigger': addtrigger,
'addot': addot,
'addspook': addspook,
"quit": quit,
"reload": reloadmods,
"commit": commit,
"raw": rawcmd,
"eval": ev,
"send": send,
"joins": joins,
"shut": shut,
"schans": schans,
"addalias": addalias,
"addtrigger": addtrigger,
"addot": addot,
"addspook": addspook,
}
@command('admin')
@command("admin")
@is_admin
async def adminHandle(self, chan, source, msg):
msg = msg.split(' ')
msg = msg.split(" ")
if len(msg) < 1 or not msg[0] in commands:
await self.message(chan, '[\x036admin\x0f] Invalid command')
return
print('[ADMIN MODULE] {} told me to {}!!!'.format(source,msg[0]))
asyncio.create_task(commands[msg.pop(0)](self, chan, source, ' '.join(msg)))
await self.message(chan, "[\x036admin\x0f] Invalid command")
return
print("[ADMIN MODULE] {} told me to {}!!!".format(source, msg[0]))
asyncio.create_task(commands[msg.pop(0)](self, chan, source, " ".join(msg)))
async def init(self):
self.chandb = shared.db['chan']
self.admins = ['xfnw']
return
self.cmd['admin'] = adminHandle
self.help['admin'] = ['admin - various bot owner commands (more for subcommands)', 'sub-commands of admin, for more info do help admin <command>: quit reload commit part join joins eval send']
self.help['admin quit'] = ['admin quit <message> - make the bot disconnect','no']
self.help['admin reload'] = ['admin reload - reload the modules and configs', 'nothing to see here']
self.help['admin commit'] = ['admin commit <action> - oh no (more)', 'suggested with <3 by khux']
self.help['admin part'] = ['admin part <channel> - leave a channel', ':o']
self.help['admin join'] = ['admin join <channel> - make the bot join a channel','...']
self.help['admin joins'] = ['admin joins - join more channels', 'dont reconnect to a bunch of chans when the bots crashing etc']
self.help['admin eval'] = ['admin eval <command> - absolute power corrupts absolutely', 'lmao']
self.help['admin send'] = ['admin send <channel> <message> - send a message', 'lmao']
self.help['admin schans'] = ['admin schans - save the commands to join',';p;']
self.chandb = shared.db["chan"]
self.admins = ["xfnw"]
return
self.cmd["admin"] = adminHandle
self.help["admin"] = [
"admin - various bot owner commands (more for subcommands)",
"sub-commands of admin, for more info do help admin <command>: quit reload commit part join joins eval send",
]
self.help["admin quit"] = ["admin quit <message> - make the bot disconnect", "no"]
self.help["admin reload"] = [
"admin reload - reload the modules and configs",
"nothing to see here",
]
self.help["admin commit"] = [
"admin commit <action> - oh no (more)",
"suggested with <3 by khux",
]
self.help["admin part"] = ["admin part <channel> - leave a channel", ":o"]
self.help["admin join"] = [
"admin join <channel> - make the bot join a channel",
"...",
]
self.help["admin joins"] = [
"admin joins - join more channels",
"dont reconnect to a bunch of chans when the bots crashing etc",
]
self.help["admin eval"] = [
"admin eval <command> - absolute power corrupts absolutely",
"lmao",
]
self.help["admin send"] = [
"admin send <channel> <message> - send a message",
"lmao",
]
self.help["admin schans"] = ["admin schans - save the commands to join", ";p;"]

View File

@ -1,12 +1,13 @@
from bot import *
modulename='botlist'
modulename = "botlist"
@rawm('botlist')
async def botlist(s,c,n,m):
if m == '!botlist':
await message(s,modulename,c,'hi im balun ; prefix . ; owner xfnw')
@rawm("botlist")
async def botlist(s, c, n, m):
if m == "!botlist":
await message(s, modulename, c, "hi im balun ; prefix . ; owner xfnw")
async def init(self):
await self.send(build("MODE",[self.nickname,'+B']))
await self.send(build("MODE", [self.nickname, "+B"]))

View File

@ -5,49 +5,56 @@ from bot import *
async def bal(self):
bals = {}
for t in self.ledger:
await asyncio.sleep(0) # yeild control as this is a long operation
t['amount'] = float(t['amount'])
if t['amount'] < 0.01:
self.ledger.delete(id=t['id'])
continue # dont send negative money lol
if t['sender'] not in bals:
bals[t['sender']]=0.00
if t['to'] not in bals:
bals[t['to']]=0.00
await asyncio.sleep(0) # yeild control as this is a long operation
t["amount"] = float(t["amount"])
if t["amount"] < 0.01:
self.ledger.delete(id=t["id"])
continue # dont send negative money lol
if t["sender"] not in bals:
bals[t["sender"]] = 0.00
if t["to"] not in bals:
bals[t["to"]] = 0.00
if t['sender'] != 'bank' and round(bals[t['sender']],2) - t['amount'] < 0.0:
self.ledger.delete(id=t['id'])
continue # no debt for you
bals[t['sender']] += 0 - t['amount']
bals[t['to']] += t['amount']
if t["sender"] != "bank" and round(bals[t["sender"]], 2) - t["amount"] < 0.0:
self.ledger.delete(id=t["id"])
continue # no debt for you
bals[t["sender"]] += 0 - t["amount"]
bals[t["to"]] += t["amount"]
for i in bals:
bals['bank'] += bals[i] * 0.001
bals["bank"] += bals[i] * 0.001
bals[i] -= bals[i] * 0.001
self.initfund = abs(bals['bank'])
self.initfund = abs(bals["bank"])
return bals
async def send(self,c,n,m):
m = m.split(' ')
async def send(self, c, n, m):
m = m.split(" ")
if len(m) < 2:
await self.message(c, '[\x036coin\x0f] invalid syntax')
await self.message(c, "[\x036coin\x0f] invalid syntax")
return
try:
to = self.users[m.pop(0).lower()].account
except:
await self.message(c, '[\x036coin\x0f] that user is not logged in. refusing so coins are not lost')
if to == '':
await self.message(c, '[\x036coin\x0f] they must authenticate with nickserv.')
await self.message(
c,
"[\x036coin\x0f] that user is not logged in. refusing so coins are not lost",
)
if to == "":
await self.message(c, "[\x036coin\x0f] they must authenticate with nickserv.")
return
amount = round(float(m.pop(0)),2)
message = ' '.join(m)
amount = round(float(m.pop(0)), 2)
message = " ".join(m)
sender = self.users[n.lower()].account
self.ledger.insert(dict(to=to,sender=sender,amount=amount,message=message))
self.ledger.insert(dict(to=to, sender=sender, amount=amount, message=message))
await self.message(c, '[\x036coin\x0f] added transaction to ledger, check balances to verify')
await self.message(
c, "[\x036coin\x0f] added transaction to ledger, check balances to verify"
)
async def balance(self,c,n,m):
async def balance(self, c, n, m):
m = m.strip()
if len(m) < 1:
m = n
@ -55,44 +62,68 @@ async def balance(self,c,n,m):
m = self.users[m.lower()].account
except:
m = m
if m == '':
if m == "":
m = m
bals = await bal(self)
if m in bals:
latest = self.ledger.find_one(to=m,order_by='-id')
latest = self.ledger.find_one(to=m, order_by="-id")
if latest:
await self.message(c, '[\x036coin\x0f] {}\u200c{}\'s balance is {} BUTT (Balun Useless Trading Tokens), {}% of the total supply'
.format(m[:1],m[1:],round(bals[m],2),int((bals[m]/self.initfund)*100))+
'. last deposit: [{} from {}, "{}"]'.format(
latest['amount'], latest['sender'], latest['message']
))
await self.message(
c,
"[\x036coin\x0f] {}\u200c{}'s balance is {} BUTT (Balun Useless Trading Tokens), {}% of the total supply".format(
m[:1],
m[1:],
round(bals[m], 2),
int((bals[m] / self.initfund) * 100),
)
+ '. last deposit: [{} from {}, "{}"]'.format(
latest["amount"], latest["sender"], latest["message"]
),
)
else:
await self.message(c, '[\x036coin\x0f] {}\u200c{}\'s balance is {} BUTT (Balun Useless Trading Tokens), {}% of the total supply'
.format(m[:1],m[1:],round(bals[m],2),int((bals[m]/self.initfund)*100)))
await self.message(
c,
"[\x036coin\x0f] {}\u200c{}'s balance is {} BUTT (Balun Useless Trading Tokens), {}% of the total supply".format(
m[:1],
m[1:],
round(bals[m], 2),
int((bals[m] / self.initfund) * 100),
),
)
else:
await self.message(c, '[\x036coin\x0f] this user has never made a transaction')
await self.message(c, "[\x036coin\x0f] this user has never made a transaction")
async def richest(self,c,n,m):
richest = sorted((await bal(self)).items(), key=lambda item: item[1], reverse=True)[:10]
await self.message(c, '[\x036coin\x0f] richest users: '+', '.join(
[
i[0][:1]+"\u200c"+i[0][1:]+": "+str(round(i[1],2))
for i in richest]
))
async def richest(self, c, n, m):
richest = sorted((await bal(self)).items(), key=lambda item: item[1], reverse=True)[
:10
]
await self.message(
c,
"[\x036coin\x0f] richest users: "
+ ", ".join(
[
i[0][:1] + "\u200c" + i[0][1:] + ": " + str(round(i[1], 2))
for i in richest
]
),
)
async def init(self):
self.ledger = shared.db['ledger']
self.ledger = shared.db["ledger"]
self.initfund = 1
shared.commands['tipcoins'] = send
shared.commands['sendcoins'] = send
shared.commands['balance'] = balance
shared.commands['richest'] = richest
shared.commands["tipcoins"] = send
shared.commands["sendcoins"] = send
shared.commands["balance"] = balance
shared.commands["richest"] = richest
return
self.help['sendcoins'] = ['sendcoins <recipient> <amount> [message] - send someone coins. note (more)','this does NOT verify transactions went through!! check your balance after']
self.help['balance'] = ['balance [person] - check someone\'s balance','coins owo']
self.help['richest'] = ['richest - who has the most coins','coins owo']
self.help["sendcoins"] = [
"sendcoins <recipient> <amount> [message] - send someone coins. note (more)",
"this does NOT verify transactions went through!! check your balance after",
]
self.help["balance"] = ["balance [person] - check someone's balance", "coins owo"]
self.help["richest"] = ["richest - who has the most coins", "coins owo"]

View File

@ -1,9 +1,6 @@
from irctokens import build, Line
import bot
async def init(self):
self.admins = ['xfnw','lickthecheese']
self.admins = ["xfnw", "lickthecheese"]

View File

@ -3,46 +3,50 @@ import random
from bot import *
async def coffeeup(self,c,n,m):
async def coffeeup(self, c, n, m):
m = m.lower()
c = c.lower()
if c in ['#coffee','#tea','#water','#caps','#sodawater']:
if c in ["#coffee", "#tea", "#water", "#caps", "#sodawater"]:
if (
(c[1:]+"!" in m and c+'!' not in m)
or c=='#coffee' and ('latte!' in m or 'espresso!' in m or 'cappucino!' in m)
or c=='#tea' and ('chai!' in m or 'kombucha!' in m)
):
(c[1:] + "!" in m and c + "!" not in m)
or c == "#coffee"
and ("latte!" in m or "espresso!" in m or "cappucino!" in m)
or c == "#tea"
and ("chai!" in m or "kombucha!" in m)
):
cc = self.coffee.find_one(name=c)
if cc:
self.coffee.update(dict(name=c,value=cc['value']+1),['name'])
self.coffee.update(dict(name=c, value=cc["value"] + 1), ["name"])
else:
self.coffee.insert(dict(name=c,value=1))
if c=='#CAPS':
await message(self, c, '・゜゜・。。・゜゜c[~] {} UP!'.format(c[1:].upper()).upper())
self.coffee.insert(dict(name=c, value=1))
if c == "#CAPS":
await message(
self, c, "・゜゜・。。・゜゜c[~] {} UP!".format(c[1:].upper()).upper()
)
else:
await message(self, c, '・゜゜・。。・゜゜c[~] {} UP!'.format(c[1:].upper()))
await message(self, c, "・゜゜・。。・゜゜c[~] {} UP!".format(c[1:].upper()))
elif "cupcount" in m:
await message(self, c, '{} delicious cups of {}{} served so far!'.format(
self.coffee.find_one(name=c)['value'], random.choice(self.coffeetypes), c[1:]
))
await message(
self,
c,
"{} delicious cups of {}{} served so far!".format(
self.coffee.find_one(name=c)["value"],
random.choice(self.coffeetypes),
c[1:],
),
)
async def init(self):
shared.rawm['coffeeup'] = coffeeup
self.coffee = shared.db['coffee']
shared.rawm["coffeeup"] = coffeeup
self.coffee = shared.db["coffee"]
self.coffeetypes = [
"kum\u200cquat's aeropressed ",
"hot ",
"OSHA-compliant ",
"cmc\u200ccabe's nom nom nom yummy ",
"healthy ",
]
"kum\u200cquat's aeropressed ",
"hot ",
"OSHA-compliant ",
"cmc\u200ccabe's nom nom nom yummy ",
"healthy ",
]
for i in range(len(self.coffeetypes)):
self.coffeetypes.append('')
self.coffeetypes.append("")

View File

@ -1,24 +1,31 @@
from bot import *
import json, requests
@command('lookup')
async def lookup(self,c,n,m):
if len(m) < 1:
await self.message(c, '[\x036ham\x0f] you need the callsign lol')
return
res = requests.get('https://callook.info/{}/json'.format(m))
if res.status_code :
js = res.json()
if js['status'] == 'VALID':
await self.message(c, '[\x036ham\x0f] {}, name: {} grid: {}, expires: {}'.format(js['current']['operClass'], js['name'], js['location']['gridsquare'], js['otherInfo']['expiryDate']))
return
await self.message(c, '[\x036ham\x0f] invalid callsign')
else:
await self.message(c, '[\x036ham\x0f] something went wrong...')
@command("lookup")
async def lookup(self, c, n, m):
if len(m) < 1:
await self.message(c, "[\x036ham\x0f] you need the callsign lol")
return
res = requests.get("https://callook.info/{}/json".format(m))
if res.status_code:
js = res.json()
if js["status"] == "VALID":
await self.message(
c,
"[\x036ham\x0f] {}, name: {} grid: {}, expires: {}".format(
js["current"]["operClass"],
js["name"],
js["location"]["gridsquare"],
js["otherInfo"]["expiryDate"],
),
)
return
await self.message(c, "[\x036ham\x0f] invalid callsign")
else:
await self.message(c, "[\x036ham\x0f] something went wrong...")
async def init(self):
pass
#self.help['lookup'] = ['lookup <callsign> - lookup a ham callsign','ROBERT']
pass
# self.help['lookup'] = ['lookup <callsign> - lookup a ham callsign','ROBERT']

View File

@ -1,9 +1,10 @@
from bot import *
@listener('INVITE')
async def on_invite(self,line):
self.send(build("JOIN",[line.params[1]]))
@listener("INVITE")
async def on_invite(self, line):
self.send(build("JOIN", [line.params[1]]))
async def init(self):
pass

View File

@ -1,89 +1,96 @@
from bot import *
import random
async def getkeep(self,c,n,m):
m = m.strip()
if len(m) < 1:
keep = random.choice([i['keep'] for i in self.keepdb.find()])
else:
async def getkeep(self, c, n, m):
m = m.strip()
if len(m) < 1:
keep = random.choice([i["keep"] for i in self.keepdb.find()])
else:
try:
keep = random.choice(
[i["keep"] for i in self.keepdb.find(keep={"like": "%{}%".format(m)})]
)
except IndexError:
await self.message(c, "[\x036keep\x0f] No keeps found.")
return
await self.message(c, "[\x036keep\x0f] {}".format(keep))
async def grabkeep(self, c, n, m):
if len(m) < 1:
m = "1"
try:
keep = random.choice([i['keep'] for i in self.keepdb.find(keep={'like':"%{}%".format(m)})])
except IndexError:
await self.message(c,'[\x036keep\x0f] No keeps found.')
return
await self.message(c,'[\x036keep\x0f] {}'.format(keep))
async def grabkeep(self,c,n,m):
if len(m) < 1:
m="1"
try:
back = int(m)+0
except:
m = m.strip().split(' ')
if c in self.owolog:
backlog = [i for i in self.owolog[c] if m[0] == i[0]]
if len(backlog) < 1:
await self.message(c,'[\x036keep\x0f] nothing found to keep')
back = int(m) + 0
except:
m = m.strip().split(" ")
if c in self.owolog:
backlog = [i for i in self.owolog[c] if m[0] == i[0]]
if len(backlog) < 1:
await self.message(c, "[\x036keep\x0f] nothing found to keep")
return
try:
ms = backlog[0 - int(m[1])]
except:
ms = backlog[-1]
m = "<{}> {}".format(ms[0], ms[1])
self.keepdb.insert(dict(channel=c, nick=n, keep=m))
await self.message(c, "[\x036keep\x0f] keep added!")
return
try:
ms = backlog[0-int(m[1])]
except:
ms = backlog[-1]
m = "<{}> {}".format(ms[0],ms[1])
self.keepdb.insert(dict(channel=c,nick=n,keep=m))
await self.message(c,'[\x036keep\x0f] keep added!')
return
if c in self.owolog and len(self.owolog[c]) >= back:
ms = self.owolog[c][0-back]
m = "<{}> {}".format(ms[0],ms[1])
else:
await self.message(c,'[\x036keep\x0f] My backlog does not go back that far ;_;]')
return
self.keepdb.insert(dict(channel=c,nick=n,keep=m))
await self.message(c,'[\x036keep\x0f] keep added!')
async def addkeep(self,c,n,m):
self.keepdb.insert(dict(channel=c,nick=n,keep=m))
await self.message(c,'[\x036keep\x0f] keep added!')
async def rmkeep(self,c,n,m):
if n in self.channels[self.rmkeepchan].users and 'o' in self.channels[self.rmkeepchan].users[n].modes:
co = m.strip().split(' ')
if len(co) < 2:
await self.message(c,'[\x036keep\x0f] wrong syntax')
return
crit = co.pop(0)
filt = ' '.join(co)
if crit == 'nick' or crit == 'n':
ou = self.keepdb.delete(nick=filt)
elif crit == 'quote' or crit == 'q':
ou = self.keepdb.delete(keep={'like':filt})
if c in self.owolog and len(self.owolog[c]) >= back:
ms = self.owolog[c][0 - back]
m = "<{}> {}".format(ms[0], ms[1])
else:
await self.message(c,'[\x036keep\x0f] invalid criterea')
if ou:
await self.message(c, '[\x036keep\x0f] removed some keep(s)')
await self.message(
c, "[\x036keep\x0f] My backlog does not go back that far ;_;]"
)
return
self.keepdb.insert(dict(channel=c, nick=n, keep=m))
await self.message(c, "[\x036keep\x0f] keep added!")
async def addkeep(self, c, n, m):
self.keepdb.insert(dict(channel=c, nick=n, keep=m))
await self.message(c, "[\x036keep\x0f] keep added!")
async def rmkeep(self, c, n, m):
if (
n in self.channels[self.rmkeepchan].users
and "o" in self.channels[self.rmkeepchan].users[n].modes
):
co = m.strip().split(" ")
if len(co) < 2:
await self.message(c, "[\x036keep\x0f] wrong syntax")
return
crit = co.pop(0)
filt = " ".join(co)
if crit == "nick" or crit == "n":
ou = self.keepdb.delete(nick=filt)
elif crit == "quote" or crit == "q":
ou = self.keepdb.delete(keep={"like": filt})
else:
await self.message(c, "[\x036keep\x0f] invalid criterea")
if ou:
await self.message(c, "[\x036keep\x0f] removed some keep(s)")
else:
await self.message(c, "[\x036keep\x0f] did not remove any")
else:
await self.message(c, '[\x036keep\x0f] did not remove any')
else:
await self.message(c,f'[\x036keep\x0f] you must have +o in {self.rmkeepchan}')
await self.message(c, f"[\x036keep\x0f] you must have +o in {self.rmkeepchan}")
async def init(self):
self.keepdb = shared.db['keep']
self.keepdb = shared.db["keep"]
shared.commands['keep'] = getkeep
#self.help['keep'] = ['keep - get keeps about keep','lets learn about keep!']
shared.commands['addkeep'] = addkeep
#self.help['addkeep'] = ['addkeep <keep> - add a new keep (more)','if you find something offensive contact lickthecheese, he can remove it and/or tell you who added it so watch out!']
shared.commands["keep"] = getkeep
# self.help['keep'] = ['keep - get keeps about keep','lets learn about keep!']
shared.commands['grabkeep'] = grabkeep
#self.help['grabkeep'] = ['grabkeep [back] - grab something to keep','tooootally did not steal this from bitbot']
shared.commands["addkeep"] = addkeep
# self.help['addkeep'] = ['addkeep <keep> - add a new keep (more)','if you find something offensive contact lickthecheese, he can remove it and/or tell you who added it so watch out!']
self.rmkeepchan = "#balun"
shared.commands['rmkeep'] = rmkeep
#self.help['rmkeep'] = ['rmkeep <criteria> <pattern> - remove some keep(s). criteria types in (more)','types of criteria: n|nick q|quote eg "rmkeep nick spammer" to get rid of all keeps created by nick spammer']
shared.commands["grabkeep"] = grabkeep
# self.help['grabkeep'] = ['grabkeep [back] - grab something to keep','tooootally did not steal this from bitbot']
self.rmkeepchan = "#balun"
shared.commands["rmkeep"] = rmkeep
# self.help['rmkeep'] = ['rmkeep <criteria> <pattern> - remove some keep(s). criteria types in (more)','types of criteria: n|nick q|quote eg "rmkeep nick spammer" to get rid of all keeps created by nick spammer']

View File

@ -1,38 +1,43 @@
from bot import *
import random
async def owologger(self,c,n,m):
print("<{} {}> {}".format(c,n,m))
if m[:len(shared.prefix)] == shared.prefix:
return
if c not in self.owolog:
self.owolog[c] = []
self.owolog[c].append([n,m])
if len(self.owolog[c]) > 333:
del self.owolog[c][:-300]
async def owologger(self, c, n, m):
print("<{} {}> {}".format(c, n, m))
if m[: len(shared.prefix)] == shared.prefix:
return
if c not in self.owolog:
self.owolog[c] = []
self.owolog[c].append([n, m])
if len(self.owolog[c]) > 333:
del self.owolog[c][:-300]
async def owoify(self, c, n, m):
if len(m) < 1:
m = "1"
try:
back = int(m) + 0
except:
back = 1
await self.message(c, await owotext(self, back, c))
async def owoify(self,c,n,m):
if len(m) < 1:
m = "1"
try:
back = int(m)+0
except:
back = 1
await self.message(c, await owotext(self, back, c))
async def owotext(self, back, chan):
if chan in self.owolog and len(self.owolog[chan]) >= back:
ms = self.owolog[chan][0-back]
ms[1] = ms[1].replace('r','w').replace('l','w').replace('uck','uwk')
return '<{}> {} {}'.format(ms[0],ms[1],random.choice(['owo','uwu','^w^','Owo?','OwO', 'oWo', 'UwU', 'uWu']))
return 'My backlog does not go back that far :('
if chan in self.owolog and len(self.owolog[chan]) >= back:
ms = self.owolog[chan][0 - back]
ms[1] = ms[1].replace("r", "w").replace("l", "w").replace("uck", "uwk")
return "<{}> {} {}".format(
ms[0],
ms[1],
random.choice(["owo", "uwu", "^w^", "Owo?", "OwO", "oWo", "UwU", "uWu"]),
)
return "My backlog does not go back that far :("
async def init(self):
self.owolog = {}
shared.rawm['owolog'] = owologger
shared.commands['owo'] = owoify
#self.help['owo'] = ['owo [num] - owoify the text', 'owo owo uwu']
self.owolog = {}
shared.rawm["owolog"] = owologger
shared.commands["owo"] = owoify
# self.help['owo'] = ['owo [num] - owoify the text', 'owo owo uwu']

View File

@ -1,93 +1,107 @@
import subprocess
from bot import *
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
try:
float(value)
return True
except ValueError:
return False
async def rpninp(self, chan, nick, msg):
if chan not in self.rpnhist:
self.rpnhist[chan] = [0]
try:
msg = msg.replace('+',' + ')
msg = msg.replace('a',' a ')
#msg = msg.replace('-',' - ')
msg = msg.replace('s',' s ')
msg = msg.replace('\\',' \\ ')
msg = msg.replace('*',' * ')
msg = msg.replace('x',' x ')
msg = msg.replace('m',' m ')
msg = msg.replace('/',' / ')
msg = msg.replace('d',' d ')
msg = msg.replace('^',' ^ ')
msg = msg.replace('e',' e ')
for m in msg.split():
self.rpnhist[chan].append(0)
del self.rpnhist[chan][15:]
if isfloat(m):
self.rpnhist[chan].insert(0, float(m))
continue
elif m == '+' or m == 'a':
self.rpnhist[chan][0] = self.rpnhist[chan][0]+self.rpnhist[chan].pop(1)
elif m == '-' or m == 's':
self.rpnhist[chan][0] = self.rpnhist[chan].pop(1)-self.rpnhist[chan][0]
elif m == '\\':
self.rpnhist[chan].insert(0,self.rpnhist[chan][0])
elif m == '*' or m == 'x' or m == 'm':
self.rpnhist[chan][0] = self.rpnhist[chan].pop(1)*self.rpnhist[chan][0]
elif m == '/' or m == 'd':
try:
self.rpnhist[chan][0] = self.rpnhist[chan].pop(1)/self.rpnhist[chan][0]
except ZeroDivisionError:
self.rpnhist[chan][0] = float('NaN')
elif m == '^' or m == 'e':
self.rpnhist[chan][0] = self.rpnhist[chan].pop(1)**self.rpnhist[chan][0]
elif msg == 'p':
pass # just dont do anything lol
elif msg == 'r':
if chan in self.rpnprint:
await self.message(chan, '[\x036rpn\x0f] {}'.format(str(self.rpnhist[chan])))
return
else:
return
except OverflowError:
if chan not in self.rpnhist:
self.rpnhist[chan] = [0]
try:
msg = msg.replace("+", " + ")
msg = msg.replace("a", " a ")
# msg = msg.replace('-',' - ')
msg = msg.replace("s", " s ")
msg = msg.replace("\\", " \\ ")
msg = msg.replace("*", " * ")
msg = msg.replace("x", " x ")
msg = msg.replace("m", " m ")
msg = msg.replace("/", " / ")
msg = msg.replace("d", " d ")
msg = msg.replace("^", " ^ ")
msg = msg.replace("e", " e ")
for m in msg.split():
self.rpnhist[chan].append(0)
del self.rpnhist[chan][15:]
if isfloat(m):
self.rpnhist[chan].insert(0, float(m))
continue
elif m == "+" or m == "a":
self.rpnhist[chan][0] = self.rpnhist[chan][0] + self.rpnhist[chan].pop(
1
)
elif m == "-" or m == "s":
self.rpnhist[chan][0] = (
self.rpnhist[chan].pop(1) - self.rpnhist[chan][0]
)
elif m == "\\":
self.rpnhist[chan].insert(0, self.rpnhist[chan][0])
elif m == "*" or m == "x" or m == "m":
self.rpnhist[chan][0] = (
self.rpnhist[chan].pop(1) * self.rpnhist[chan][0]
)
elif m == "/" or m == "d":
try:
self.rpnhist[chan][0] = (
self.rpnhist[chan].pop(1) / self.rpnhist[chan][0]
)
except ZeroDivisionError:
self.rpnhist[chan][0] = float("NaN")
elif m == "^" or m == "e":
self.rpnhist[chan][0] = (
self.rpnhist[chan].pop(1) ** self.rpnhist[chan][0]
)
elif msg == "p":
pass # just dont do anything lol
elif msg == "r":
if chan in self.rpnprint:
await self.message(
chan, "[\x036rpn\x0f] {}".format(str(self.rpnhist[chan]))
)
return
else:
return
except OverflowError:
if chan in self.rpnprint:
await self.message(chan, "[\x036rpn\x0f] no u ur numbers are too phat")
return
if chan in self.rpnprint:
await self.message(chan, '[\x036rpn\x0f] no u ur numbers are too phat')
return
if chan in self.rpnprint:
await self.message(chan, '[\x036rpn\x0f] '+str(self.rpnhist[chan][0]))
await self.message(chan, "[\x036rpn\x0f] " + str(self.rpnhist[chan][0]))
async def rpntinp(self, chan, nick, msg):
if chan in self.rpnprint:
await rpninp(self, chan, nick, msg)
else:
self.rpnprint.append(chan)
await rpninp(self, chan, nick, msg)
self.rpnprint.remove(chan)
if chan in self.rpnprint:
await rpninp(self, chan, nick, msg)
else:
self.rpnprint.append(chan)
await rpninp(self, chan, nick, msg)
self.rpnprint.remove(chan)
async def rpntoggle(self, chan, nick, msg):
if chan in self.rpnprint:
self.rpnprint.remove(chan)
await self.message(chan, '[\x036rpn\x0f] rpn outputting has been disabled')
else:
self.rpnprint.append(chan)
await self.message(chan, '[\x036rpn\x0f] rpn outputting has been enabled')
if chan in self.rpnprint:
self.rpnprint.remove(chan)
await self.message(chan, "[\x036rpn\x0f] rpn outputting has been disabled")
else:
self.rpnprint.append(chan)
await self.message(chan, "[\x036rpn\x0f] rpn outputting has been enabled")
async def init(self):
#self.help['rpn'] = ['rpn <inp> - simple reverse polish notation calculator (more)', 'it has an alias of . so you can just do {}. <inp>, and if enabled it will also parse floats and functions as input. there are 4 functions, add (+|a), subtract (-|s), multiply (*|x|m), and devide (/|d), and p to print register 0'.format(self.prefix)]
shared.commands['rpn'] = rpntinp
shared.commands['.'] = rpntinp
shared.rawm['rpn'] = rpninp
shared.commands['rt'] = rpntoggle
#self.help['rt'] = ['rt - toggle the output of rpn calculatons into the channel', 'rpn is cool']
# self.help['rpn'] = ['rpn <inp> - simple reverse polish notation calculator (more)', 'it has an alias of . so you can just do {}. <inp>, and if enabled it will also parse floats and functions as input. there are 4 functions, add (+|a), subtract (-|s), multiply (*|x|m), and devide (/|d), and p to print register 0'.format(self.prefix)]
shared.commands["rpn"] = rpntinp
shared.commands["."] = rpntinp
shared.rawm["rpn"] = rpninp
shared.commands["rt"] = rpntoggle
# self.help['rt'] = ['rt - toggle the output of rpn calculatons into the channel', 'rpn is cool']
self.rpnhist = {}
self.rpnhist = {}
self.rpnprint = []
self.rpnprint = []

View File

@ -1,14 +1,13 @@
import asyncio
import asyncio
import bot
@bot.command('test')
@bot.command("test")
@bot.is_admin
async def testy(self,channel,nick,msg):
await bot.message(self,channel,'hi there')
async def testy(self, channel, nick, msg):
await bot.message(self, channel, "hi there")
async def init(self):
await self.send_raw("join #bots")

View File

@ -1,16 +1,13 @@
async def action(self,c,n,m):
await self.message(c,'\x01ACTION {}\x01'.format(m[:400]))
async def action(self, c, n, m):
await self.message(c, "\x01ACTION {}\x01".format(m[:400]))
async def echo(self,c,n,m):
await self.message(c,'[\x036channels\x0f] {}'.format(m[:400]))
async def echo(self, c, n, m):
await self.message(c, "[\x036channels\x0f] {}".format(m[:400]))
async def init(self):
self.chansjoin = ['#bots']
self.cmd['echo']=echo
self.cmd['action']=action
self.chansjoin = ["#bots"]
self.cmd["echo"] = echo
self.cmd["action"] = action

View File

@ -1,52 +1,62 @@
import random
async def getfact(self,c,n,m):
if len(m) < 1:
fact = random.choice([i['fact'] for i in self.est.find()])
else:
try:
fact = random.choice([i['fact'] for i in self.est.find(fact={'like':"%{}%".format(m)})])
except IndexError:
await self.message(c,'[\x036estonia\x0f] No facts found.')
return
await self.message(c,'[\x036estonia\x0f] fact: {}'.format(fact))
async def addfact(self,c,n,m):
self.est.insert(dict(channel=c,nick=n,fact=m))
await self.message(c,'[\x036estonia\x0f] fact added!')
async def getfact(self, c, n, m):
if len(m) < 1:
fact = random.choice([i["fact"] for i in self.est.find()])
else:
try:
fact = random.choice(
[i["fact"] for i in self.est.find(fact={"like": "%{}%".format(m)})]
)
except IndexError:
await self.message(c, "[\x036estonia\x0f] No facts found.")
return
await self.message(c, "[\x036estonia\x0f] fact: {}".format(fact))
async def rmfact(self,c,n,m):
if n in self.channels[self.rmfactchan]['modes']['o']:
co = m.strip().split(' ')
if len(co) < 2:
await self.message(c,'[\x036estonia\x0f] wrong syntax')
return
crit = co.pop(0)
filt = ' '.join(co)
if crit == 'nick' or crit == 'n':
ou = self.est.delete(nick=filt)
elif crit == 'fact' or crit == 'f':
ou = self.est.delete(fact={'like':filt})
async def addfact(self, c, n, m):
self.est.insert(dict(channel=c, nick=n, fact=m))
await self.message(c, "[\x036estonia\x0f] fact added!")
async def rmfact(self, c, n, m):
if n in self.channels[self.rmfactchan]["modes"]["o"]:
co = m.strip().split(" ")
if len(co) < 2:
await self.message(c, "[\x036estonia\x0f] wrong syntax")
return
crit = co.pop(0)
filt = " ".join(co)
if crit == "nick" or crit == "n":
ou = self.est.delete(nick=filt)
elif crit == "fact" or crit == "f":
ou = self.est.delete(fact={"like": filt})
else:
await self.message(c, "[\x036estonia\x0f] invalid criterea")
if ou:
await self.message(c, "[\x036estonia\x0f] removed some fact(s)")
else:
await self.message(c, "[\x036estonia\x0f] did not remove any")
else:
await self.message(c,'[\x036estonia\x0f] invalid criterea')
if ou:
await self.message(c, '[\x036estonia\x0f] removed some fact(s)')
else:
await self.message(c, '[\x036estonia\x0f] did not remove any')
else:
await self.message(c,'[\x036estonia\x0f] you must have +o in #estonia')
await self.message(c, "[\x036estonia\x0f] you must have +o in #estonia")
async def init(self):
self.est = self.db['estonia']
self.est = self.db["estonia"]
self.cmd['fact'] = getfact
self.help['fact'] = ['fact - get facts about estonia','lets learn about estonia!']
self.cmd['addfact'] = addfact
self.help['addfact'] = ['addfact <fact> - add a new fact (more)','if you find something offensive contact lickthecheese, he can remove it and/or tell you who added it so watch out!']
self.cmd["fact"] = getfact
self.help["fact"] = ["fact - get facts about estonia", "lets learn about estonia!"]
self.rmfactchan = "#estonia"
self.cmd['rmfact'] = rmfact
self.help['rmfact'] = ['rmfact <criteria> <pattern> - remove some fact(s). criteria types in (more)','types of criteria: n|nick f|fact eg "rmfact nick spammer" to get rid of all facts created by nick spammer']
self.cmd["addfact"] = addfact
self.help["addfact"] = [
"addfact <fact> - add a new fact (more)",
"if you find something offensive contact lickthecheese, he can remove it and/or tell you who added it so watch out!",
]
self.rmfactchan = "#estonia"
self.cmd["rmfact"] = rmfact
self.help["rmfact"] = [
"rmfact <criteria> <pattern> - remove some fact(s). criteria types in (more)",
'types of criteria: n|nick f|fact eg "rmfact nick spammer" to get rid of all facts created by nick spammer',
]

View File

@ -1,35 +1,44 @@
async def helpParse(self, c, n, m):
if m in self.help:
self.more[c] = self.help[m][1]
await self.message(c, '[\x036help\x0f] '+self.help[m][0])
else:
await self.message(c, '[\x036help\x0f] my nice commands are {}'.format(', '.join([i for i in self.help if not ' ' in i])))
if m in self.help:
self.more[c] = self.help[m][1]
await self.message(c, "[\x036help\x0f] " + self.help[m][0])
else:
await self.message(
c,
"[\x036help\x0f] my nice commands are {}".format(
", ".join([i for i in self.help if not " " in i])
),
)
async def more(self, c, n, m):
if c in self.more:
moretext = self.more.pop(c)
if len(moretext) > 300:
self.more[c]=moretext[250:]
moretext = moretext[:250]+' (more)'
if c in self.more:
moretext = self.more.pop(c)
if len(moretext) > 300:
self.more[c] = moretext[250:]
moretext = moretext[:250] + " (more)"
await self.message(c, '[\x036help\x0f] '+moretext)
return
else:
await self.message(c, '[\x036help\x0f] there is no more more text lmao stop')
await self.message(c, "[\x036help\x0f] " + moretext)
return
else:
await self.message(c, "[\x036help\x0f] there is no more more text lmao stop")
async def init(self):
self.cmd['help'] = helpParse
self.cmd['more'] = more
self.cmd["help"] = helpParse
self.cmd["more"] = more
self.help['help'] = ['help command - list commands or show info about one', 'i hope this was helpful']
self.help['help command'] = ['help <command> - show more info about a command (more)', 'there is even a more, for a even more in depth look!']
self.help['more'] = ['more - see more stuff when there is (more)', 'good job you did it lol']
self.more={}
self.help["help"] = [
"help command - list commands or show info about one",
"i hope this was helpful",
]
self.help["help command"] = [
"help <command> - show more info about a command (more)",
"there is even a more, for a even more in depth look!",
]
self.help["more"] = [
"more - see more stuff when there is (more)",
"good job you did it lol",
]
self.more = {}

View File

@ -1,16 +1,20 @@
async def listMods(self, c, n, m):
await self.message(
c,
"[\x036modulemanager\x0f] currently loaded mods: {}".format(
list(self.modules.keys())
),
)
async def listMods(self,c,n,m):
await self.message(c,'[\x036modulemanager\x0f] currently loaded mods: {}'.format(list(self.modules.keys())))
async def source(self,c,n,m):
if m == self.nickname+': source':
await self.message(c,'[\x036modulemanager\x0f] My source is at https://xfnw.ttm.sh/git/oirc/')
async def source(self, c, n, m):
if m == self.nickname + ": source":
await self.message(
c, "[\x036modulemanager\x0f] My source is at https://xfnw.ttm.sh/git/oirc/"
)
async def init(self):
self.help['modules'] = ['modules - list the modules',':o']
self.cmd['modules'] = listMods
self.rawm['source'] = source
self.help["modules"] = ["modules - list the modules", ":o"]
self.cmd["modules"] = listMods
self.rawm["source"] = source

View File

@ -1,36 +1,42 @@
import random
async def plogger(self,c,n,m):
if c not in self.plog:
self.plog[c] = []
self.plog[c].append([n,m])
if len(self.plog[c]) > 50:
del self.plog[c][:-50]
async def plogger(self, c, n, m):
if c not in self.plog:
self.plog[c] = []
self.plog[c].append([n, m])
if len(self.plog[c]) > 50:
del self.plog[c][:-50]
if c in self.channels and 'o' in self.channels[c]['modes'] and self.nickname in self.channels[c]['modes']['o'] and ('v' not in self.channels[c]['modes'] or n not in self.channels[c]['modes']['v']):
# fun time
umc = len([i for i in self.plog[c][-10:] if i[0]==n])
#await self.message(c,str(umc))
if umc > 6:
if n in self.wlevel:
self.wlevel[n] += 1
else:
self.wlevel[n] = 0
if self.wlevel[n] == 3:
await self.set_mode(c,self.mutesyntax[0],self.mutesyntax[1].format(n+'!*@*'))
if self.wlevel[n] > 10:
self.wlevel[n] = 0
await self.kick(c,n,'stop spamming thanks')
if (
c in self.channels
and "o" in self.channels[c]["modes"]
and self.nickname in self.channels[c]["modes"]["o"]
and (
"v" not in self.channels[c]["modes"]
or n not in self.channels[c]["modes"]["v"]
)
):
# fun time
umc = len([i for i in self.plog[c][-10:] if i[0] == n])
# await self.message(c,str(umc))
if umc > 6:
if n in self.wlevel:
self.wlevel[n] += 1
else:
self.wlevel[n] = 0
if self.wlevel[n] == 3:
await self.set_mode(
c, self.mutesyntax[0], self.mutesyntax[1].format(n + "!*@*")
)
if self.wlevel[n] > 10:
self.wlevel[n] = 0
await self.kick(c, n, "stop spamming thanks")
async def init(self):
self.plog = {}
self.wlevel = {}
self.mutesyntax = ['+b','m:{}'] # ['+q','{}'] on freenode
self.rawm['preventionlog'] = plogger
self.plog = {}
self.wlevel = {}
self.mutesyntax = ["+b", "m:{}"] # ['+q','{}'] on freenode
self.rawm["preventionlog"] = plogger

View File

@ -1,4 +1,3 @@
import requests, asyncio
@ -15,25 +14,23 @@ def timeDelta(dt):
now = datetime.datetime.now()
delta_time = dt - now
delta = delta_time.days * DAY + delta_time.seconds
delta = delta_time.days * DAY + delta_time.seconds
minutes = delta / MINUTE
hours = delta / HOUR
days = delta / DAY
if delta < 0:
if delta < 0:
return "currently (should) be playing right now"
if delta < 1 * MINUTE:
if delta == 1:
return "in one second"
else:
return str(delta) + " seconds to go"
if delta < 1 * MINUTE:
if delta == 1:
return "in one second"
else:
return str(delta) + " seconds to go"
if delta < 2 * MINUTE:
return "in a minute"
if delta < 45 * MINUTE:
return str(int(minutes)) + " minutes to go"
@ -49,7 +46,6 @@ def timeDelta(dt):
if delta < 30 * DAY:
return str(int(days)) + " days to go"
if delta < 12 * MONTH:
months = delta / MONTH
if months <= 1:
@ -57,14 +53,11 @@ def timeDelta(dt):
else:
return str(int(months)) + " months to go"
else:
years = days / 365.0
if years <= 1:
return "one year to go"
else:
return str(int(years)) + " years to go"
years = days / 365.0
if years <= 1:
return "one year to go"
else:
return str(int(years)) + " years to go"
def formatSec(dt):
@ -74,20 +67,18 @@ def formatSec(dt):
hours = delta / HOUR
days = delta / DAY
if delta < 0:
if delta < 0:
return "??"
if delta < 1 * MINUTE:
if delta == 1:
return "one second"
else:
return str(delta) + " seconds"
if delta < 1 * MINUTE:
if delta == 1:
return "one second"
else:
return str(delta) + " seconds"
if delta < 2 * MINUTE:
return "a minute"
if delta < 45 * MINUTE:
return str(int(minutes)) + " minutes"
@ -103,7 +94,6 @@ def formatSec(dt):
if delta < 30 * DAY:
return str(int(days)) + " days"
if delta < 12 * MONTH:
months = delta / MONTH
if months <= 1:
@ -111,63 +101,90 @@ def formatSec(dt):
else:
return str(int(months)) + " months"
else:
years = days / 365.0
if years <= 1:
return "one year"
else:
return str(int(years)) + " years"
years = days / 365.0
if years <= 1:
return "one year"
else:
return str(int(years)) + " years"
async def upnext(self,c,n,m):
if self.tildebot and c in self.channels and 'tildebot' in self.channels[c]['users']:
return # only respond in #tr whilst tildebot is down
res = requests.get('https://radio.tildeverse.org/api/station/1/schedule')
async def upnext(self, c, n, m):
if self.tildebot and c in self.channels and "tildebot" in self.channels[c]["users"]:
return # only respond in #tr whilst tildebot is down
res = requests.get("https://radio.tildeverse.org/api/station/1/schedule")
if res.status_code == 200:
js = res.json()
if len(js) < 1:
await self.message(c,'[\x036radio\x0f] it appears that there is nothing on the schedule...')
await self.message(
c,
"[\x036radio\x0f] it appears that there is nothing on the schedule...",
)
return
up = js[0]
await self.message(c,'[\x036radio\x0f] Up next: {}, {}!'.format(up['name'],timeDelta(up['start_timestamp'])))
await self.message(
c,
"[\x036radio\x0f] Up next: {}, {}!".format(
up["name"], timeDelta(up["start_timestamp"])
),
)
else:
await self.message(c,'[\x036radio\x0f] something went wrong...')
await self.message(c, "[\x036radio\x0f] something went wrong...")
async def nowplaying(self,c,n,m):
if self.tildebot and c in self.channels and 'tildebot' in self.channels[c]['users']:
return # only respond in #tr whilst tildebot is down
async def nowplaying(self, c, n, m):
if self.tildebot and c in self.channels and "tildebot" in self.channels[c]["users"]:
return # only respond in #tr whilst tildebot is down
res = requests.get("https://radio.tildeverse.org/api/nowplaying/1")
if res.status_code == 200:
js = res.json()
if "station" not in js:
await self.message(c,'[\x036radio\x0f] something went wrong...')
await self.message(c, "[\x036radio\x0f] something went wrong...")
return
np = js['now_playing']
#print(np)
if np['streamer'] == "":
await self.message(c,'[\x036radio\x0f] autodj has been playing {} for {} (next song in {})'.format(np['song']['text'],formatSec(np['elapsed']),formatSec(np['remaining']-1)))
np = js["now_playing"]
# print(np)
if np["streamer"] == "":
await self.message(
c,
"[\x036radio\x0f] autodj has been playing {} for {} (next song in {})".format(
np["song"]["text"],
formatSec(np["elapsed"]),
formatSec(np["remaining"] - 1),
),
)
else:
await self.message(c,'[\x036radio\x0f] {} has been playing "{}" for {} (next song in {}) ({} listeners!)'.format(np['streamer'],np['song']['text'],formatSec(np['elapsed']),formatSec(np['remaining']-1),js['listeners']['current']))
await self.message(
c,
'[\x036radio\x0f] {} has been playing "{}" for {} (next song in {}) ({} listeners!)'.format(
np["streamer"],
np["song"]["text"],
formatSec(np["elapsed"]),
formatSec(np["remaining"] - 1),
js["listeners"]["current"],
),
)
else:
await self.message(c,'[\x036radio\x0f] something went wrong...')
await self.message(c, "[\x036radio\x0f] something went wrong...")
async def radioremind(self,c,n,m,scindex=0):
res = requests.get('https://radio.tildeverse.org/api/station/1/schedule')
async def radioremind(self, c, n, m, scindex=0):
res = requests.get("https://radio.tildeverse.org/api/station/1/schedule")
if res.status_code == 200:
js = res.json()
if len(js) < scindex+1:
await self.message(c,'[\x036radio\x0f] it appears that there is nothing on the schedule...')
if len(js) < scindex + 1:
await self.message(
c,
"[\x036radio\x0f] it appears that there is nothing on the schedule...",
)
return
up = js[scindex]
dt = datetime.datetime.fromtimestamp(up['start_timestamp'])
dt = datetime.datetime.fromtimestamp(up["start_timestamp"])
now = datetime.datetime.now()
delta_time = (dt - now)
delta_time = dt - now
delta_time = (delta_time.days * DAY + delta_time.seconds) - 30
if delta_time < 1:
await radioremind(self,c,n,m,scindex=scindex+1)
await radioremind(self, c, n, m, scindex=scindex + 1)
return
if len(m.strip()) > 0:
toremind = m.strip()
@ -175,38 +192,56 @@ async def radioremind(self,c,n,m,scindex=0):
toremind = c
if toremind in self.rreminders:
await self.message(c,'[\x036radio\x0f] There is already a reminder set for {}, you can also specify somewhere else to send the reminder'.format(toremind))
await self.message(
c,
"[\x036radio\x0f] There is already a reminder set for {}, you can also specify somewhere else to send the reminder".format(
toremind
),
)
return
await self.message(c,'[\x036radio\x0f] ok, il remind {} when its time for {}\'s show! (in {})'.format(toremind,up['name'],formatSec(delta_time)))
task = asyncio.get_event_loop().create_task(remindTask(self, n, up, delta_time, toremind))
await self.message(
c,
"[\x036radio\x0f] ok, il remind {} when its time for {}'s show! (in {})".format(
toremind, up["name"], formatSec(delta_time)
),
)
task = asyncio.get_event_loop().create_task(
remindTask(self, n, up, delta_time, toremind)
)
self.rreminders[toremind] = task
try:
await task
except asyncio.CancelledError:
print('Reminder for {} cancelled'.format(toremind))
print("Reminder for {} cancelled".format(toremind))
finally:
print('Reminder for {} finished'.format(toremind))
print("Reminder for {} finished".format(toremind))
self.rreminders.pop(toremind)
else:
await self.message(c,'[\x036radio\x0f] something went wrong...')
await self.message(c, "[\x036radio\x0f] something went wrong...")
async def remindTask(self, n, up, delta_time,c):
async def remindTask(self, n, up, delta_time, c):
await asyncio.sleep(delta_time)
await self.message(c,'[\x036radio\x0f] beep boop, {} is here to remind you that {}\'s show is coming up in about 30 seconds!'.format(n,up['name']))
await self.message(
c,
"[\x036radio\x0f] beep boop, {} is here to remind you that {}'s show is coming up in about 30 seconds!".format(
n, up["name"]
),
)
async def init(self):
self.tildebot = True
self.rreminders = {}
self.cmd['un'] = upnext
self.cmd['upnext'] = upnext
self.cmd['radioremind'] = radioremind
self.help['radioremind'] = ['radioremind [where] - set a reminder that someone will stream','oh no i forgot what to put here!']
#self.help['upnext'] = ['upnext - get who will be up next on tilderadio\'s schedule','noice moosic']
self.cmd['nowplaying'] = nowplaying
#self.help['nowplaying'] = ['nowplaying - when radiobot is dead use this instead!','lol']
self.cmd["un"] = upnext
self.cmd["upnext"] = upnext
self.cmd["radioremind"] = radioremind
self.help["radioremind"] = [
"radioremind [where] - set a reminder that someone will stream",
"oh no i forgot what to put here!",
]
# self.help['upnext'] = ['upnext - get who will be up next on tilderadio\'s schedule','noice moosic']
self.cmd["nowplaying"] = nowplaying
# self.help['nowplaying'] = ['nowplaying - when radiobot is dead use this instead!','lol']

View File

@ -1,30 +1,44 @@
# '[\x0303Pronouns\x03] Pronouns for xfnw: he/him'
async def scraper(self,c,n,m):
m = m.split(' ')
async def scraper(self, c, n, m):
m = m.split(" ")
if len(m) > 4:
if m.pop(0) in ('[\x0303Pronouns\x03]', '[Pronouns]') and m.pop(0) == 'Pronouns' and m.pop(0) == 'for':
if (
m.pop(0) in ("[\x0303Pronouns\x03]", "[Pronouns]")
and m.pop(0) == "Pronouns"
and m.pop(0) == "for"
):
person = m.pop(0)[:-1]
pronouns = ' '.join(m)
pronouns = " ".join(m)
print('found pronouns of {}: {}'.format(person,pronouns))
self.pronoundb.upsert(dict(nick=person,pronouns=pronouns),['nick'])
print("found pronouns of {}: {}".format(person, pronouns))
self.pronoundb.upsert(dict(nick=person, pronouns=pronouns), ["nick"])
async def getPronouns(self,c,n,m):
async def getPronouns(self, c, n, m):
m = m.strip()
if not m:
m = n
pronoun = self.pronoundb.find_one(nick=m)
if pronoun:
await self.message(c,'[\x036scrape\x0f] Pronouns for {}: {}'.format(pronoun['nick'],pronoun['pronouns']))
await self.message(
c,
"[\x036scrape\x0f] Pronouns for {}: {}".format(
pronoun["nick"], pronoun["pronouns"]
),
)
else:
await self.message(c,'[\x036scrape\x0f] sorry i could not find {}\'s pronouns. (i scrape pronouns from logs, you dont need to set them :3 )'.format(m))
await self.message(
c,
"[\x036scrape\x0f] sorry i could not find {}'s pronouns. (i scrape pronouns from logs, you dont need to set them :3 )".format(
m
),
)
async def init(self):
self.rawm['scraper'] = scraper
self.pronoundb = self.db['pronouns']
self.cmd['pronouns'] = getPronouns
self.rawm["scraper"] = scraper
self.pronoundb = self.db["pronouns"]
self.cmd["pronouns"] = getPronouns

View File

@ -1,72 +1,83 @@
import asyncio
async def on_join(self,channel,person):
async def on_join(self, channel, person):
if person in self.users:
user = self.users[person]
self.userdb.insert_ignore(dict(user),['id'])
self.userdb.insert_ignore(dict(user), ["id"])
async def on_all(self,wtime=100):
print('will index users in ',wtime)
async def on_all(self, wtime=100):
print("will index users in ", wtime)
await asyncio.sleep(wtime)
print('started indexing users')
print("started indexing users")
users = self.users.copy()
for person in users:
user = self.users[person]
await asyncio.sleep(0)
self.userdb.insert_ignore(dict(user),['id'])
print('done')
self.userdb.insert_ignore(dict(user), ["id"])
print("done")
async def maskfind(self,c,n,m):
host = nick = ident = '%'
m = m.strip().replace("*","%").split('@')
async def maskfind(self, c, n, m):
host = nick = ident = "%"
m = m.strip().replace("*", "%").split("@")
host = m.pop()
if len(m) > 0:
ni = m.pop().split('!')
ni = m.pop().split("!")
ident = ni.pop()
if len(ni) > 0:
nick = ni.pop()
alts = ["{}!{}@{}".format(i['nickname'],i['username'][:1]+"\u200c"+i['username'][1:],i['hostname']) for i in self.userdb.find(hostname={'like':host},username={'like':ident},nickname={'like':nick},order_by='-id')]
falt=' '.join([i[:1]+'\u200c'+i[1:] for i in list(set(alts))])
alts = [
"{}!{}@{}".format(
i["nickname"],
i["username"][:1] + "\u200c" + i["username"][1:],
i["hostname"],
)
for i in self.userdb.find(
hostname={"like": host},
username={"like": ident},
nickname={"like": nick},
order_by="-id",
)
]
falt = " ".join([i[:1] + "\u200c" + i[1:] for i in list(set(alts))])
if len(falt) > 250:
self.more[c] = falt[200:]
falt = falt[:200]+' (more)'
await self.message(c,'[\x036usrinfo\x0f] masks: {}'.format(falt))
falt = falt[:200] + " (more)"
await self.message(c, "[\x036usrinfo\x0f] masks: {}".format(falt))
async def findalt(self,c,n,m):
async def findalt(self, c, n, m):
m = m.strip()
user = self.userdb.find_one(nickname={'like':m},order_by='-id')
user = self.userdb.find_one(nickname={"like": m}, order_by="-id")
if user == None:
await self.message(c,'[\x036usrinfo\x0f] I could not find that user :(')
await self.message(c, "[\x036usrinfo\x0f] I could not find that user :(")
# check if identd
if user['username'][0] == '~':
if user["username"][0] == "~":
# not identd
alts = [i['nickname'] for i in self.userdb.find(hostname=user['hostname'])]
alts = [i["nickname"] for i in self.userdb.find(hostname=user["hostname"])]
else:
alts = [i['nickname'] for i in self.userdb.find(username=user['username'])]
alts = [i["nickname"] for i in self.userdb.find(username=user["username"])]
if len(alts) < 2:
await self.message(c,'[\x036usrinfo\x0f] I could not find any alts :(')
await self.message(c, "[\x036usrinfo\x0f] I could not find any alts :(")
return
falt=' '.join([i[:1]+'\u200c'+i[1:] for i in sorted(list(set(alts)))])
falt = " ".join([i[:1] + "\u200c" + i[1:] for i in sorted(list(set(alts)))])
if len(falt) > 250:
self.more[c] = falt[200:]
falt = falt[:200]+' (more)'
await self.message(c,'[\x036usrinfo\x0f] alts: {}'.format(falt))
falt = falt[:200] + " (more)"
await self.message(c, "[\x036usrinfo\x0f] alts: {}".format(falt))
async def init(self):
self.userdb = self.db['user']
self.userdb = self.db["user"]
if not self.userdb.find_one(sync='yes'):
self.userdb.insert(dict(sync='yes'))
if not self.userdb.find_one(sync="yes"):
self.userdb.insert(dict(sync="yes"))
asyncio.get_event_loop().create_task(on_all(self))
self.help['findalt'] = ['findalt <nick> - find out who someone\'s alts are',';p']
self.cmd['findalt'] = findalt
self.help['maskfind'] = ['maskfind <mask> - search masks','OW']
self.cmd['maskfind'] = maskfind
self.help["findalt"] = ["findalt <nick> - find out who someone's alts are", ";p"]
self.cmd["findalt"] = findalt
self.help["maskfind"] = ["maskfind <mask> - search masks", "OW"]
self.cmd["maskfind"] = maskfind

View File

@ -1,11 +1,8 @@
import dataset
prefix = '.'
prefix = "."
modules = {}
listeners = []
commands = {}
rawm = {}
db = dataset.connect('sqlite:///database.db')
db = dataset.connect("sqlite:///database.db")