Compare commits

...

2 Commits

Author SHA1 Message Date
randomuser 403f7e9e2d small production changes 2021-07-21 16:40:39 -05:00
randomuser f7ad09480b add admin.Admin() interface 2021-07-21 16:29:44 -05:00
1 changed files with 6 additions and 10 deletions

16
main.py
View File

@ -9,19 +9,15 @@ from db import DuckStats
from channels import ChannelDB
from lang import lang
from admin import Admin
from irctokens import build, Line
from ircrobots import Bot as BaseBot
from ircrobots import Server as BaseServer
from ircrobots import ConnectionParams
lang = {
"noduck": "there was no duck! you missed by {} seconds!",
"noduckstart": "there was no duck!",
"duckcought": "duck has been cought by {} in channel {} in {} seconds!",
"duck": "・゜゜・。。・゜゜\_o< QUACK!",
"stats": "{} has befriended {} ducks in {} different channels, having a befriend/loss ratio of {}.",
}
class DuckLogic:
async def new_duck(self):
self.messages = 0
@ -30,7 +26,7 @@ class DuckLogic:
await self.msgall(lang["duck"])
async def duck_test(self):
if self.messages > 1 and random.randint(0, 99) < 10: await self.new_duck()
if self.messages > 100 and random.randint(0, 99) < 10: await self.new_duck()
async def misstime(self):
return format(time.time() - self.lastduck, '.2f')
@ -83,7 +79,7 @@ class Server(BaseServer, DuckLogic):
user = line.hostmask.nickname
args = line.params[1].split(' ')[1:]
if cmd == "bef": await self.duck_action(user, chan)
elif cmd == "trigger": await self.new_duck()
# elif cmd == "trigger": await self.new_duck()
elif cmd == "stats":
db = DuckDB(self.db)
stats = DuckStats(db)