clear out the oven for some ai stuff
This commit is contained in:
parent
ad34e105f8
commit
555efcf586
9 changed files with 12 additions and 203 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
137
modules/bake.py
137
modules/bake.py
|
@ -1,137 +0,0 @@
|
|||
|
||||
import dataset
|
||||
import random
|
||||
|
||||
async def purge(self, c, n, m):
|
||||
if not await self.is_admin(n):
|
||||
await self.message(c,'{} was a bad bad bad. {} got sucked into the oven'.format(n,n))
|
||||
if len(m) < 1:
|
||||
await message(c, 'i refuse.')
|
||||
return
|
||||
inv = self.db['inv']
|
||||
inv.delete(name=m)
|
||||
await self.message(c,'ok lel')
|
||||
|
||||
|
||||
async def cheat(self, c, n, m):
|
||||
if not await self.is_admin(n):
|
||||
await self.message(c,'{} was a bad bad bad. {} got sucked into the oven'.format(n,n))
|
||||
m = m.split(' ')
|
||||
if len(m) < 2:
|
||||
await message(c, 'i refuse.')
|
||||
return
|
||||
inv = self.db['inv']
|
||||
inv.insert(dict(name=m[0], item=m[1]))
|
||||
await self.message(c,'ok il allow this once')
|
||||
|
||||
async def give(self, c, n, m):
|
||||
m = m.split(' ')
|
||||
if len(m) < 2:
|
||||
await self.message(c, 'dummy thicc you cant give air!')
|
||||
inv = self.db['inv']
|
||||
its = inv.find_one(name=n, item=m[1])
|
||||
if its == None:
|
||||
await self.message(c, 'dummy thicc you cant trick me!')
|
||||
inv.delete(id=its['id'])
|
||||
inv.insert(dict(name=m[0], item=its['item']))
|
||||
await self.message(c, 'you gave {} a {}!'.format(m[0], m[1]))
|
||||
|
||||
async def bake(self, c, n, m):
|
||||
if len(m) < 1:
|
||||
await self.message(c, 'Dummy thicc you cant bake air!')
|
||||
return
|
||||
inv = self.db['inv']
|
||||
its = (inv.find_one(name=n, item=m))
|
||||
if its == None:
|
||||
await self.message(c, 'You dont have any {}'.format(m[:10]))
|
||||
return
|
||||
|
||||
# if item has value, use that, else use a okay value
|
||||
if m in list(self.bakedGoods.keys()):
|
||||
value = self.bakedGoods[m]
|
||||
else:
|
||||
value = 15
|
||||
|
||||
# consume the item
|
||||
inv.delete(id=its['id'])
|
||||
|
||||
# oooo randomize what will pop out
|
||||
value += random.uniform(-20, 20)
|
||||
|
||||
# choose the output
|
||||
while value not in list(self.bakedPrice.keys()):
|
||||
value = int(value - 1)
|
||||
if value < 0:
|
||||
await self.message(c, 'you notice some smoke, shouldint have put that {} in the oven!'.format(m))
|
||||
return
|
||||
|
||||
newitem = self.bakedPrice[value]
|
||||
|
||||
inv.insert(dict(name=n, item=newitem))
|
||||
|
||||
await self.message(c, 'You bake your {}, and out pops a {}!'.format(m, newitem))
|
||||
|
||||
async def invsee(self, c, n, m):
|
||||
if len(m) < 1:
|
||||
m = n.strip()
|
||||
inv = self.db['inv']
|
||||
it = [ i['item'] for i in inv.find(name=m) ]
|
||||
if len(it) < 1:
|
||||
await self.message(c, 'you look through your kitchen and see nothing')
|
||||
else:
|
||||
await self.message(c, 'you look through your kitchen and see {}, with a combined value of ${}'.format(' '.join(it), sum([self.bakedGoods[i] for i in it if i in self.bakedGoods])/10))
|
||||
self.timeout += len(' '.join(it))/300
|
||||
|
||||
async def generate(self, c, n, m):
|
||||
if int(random.uniform(0,30)) == 1:
|
||||
inv = self.db['inv']
|
||||
inv.insert(dict(name=n, item=random.choice(list(self.bakedGoods.keys()))))
|
||||
qed = self.db['qed']
|
||||
if qed.find_one(name=n) == None:
|
||||
qed.insert(dict(name=n))
|
||||
await self.message(n, 'Ding! you left some stuff in the oven! (you were lucky and found an item!!!) check out what you have with "ov items" and you can do cool stuff like bake them! (i will not query you again, so periodically check for new items!)')
|
||||
|
||||
async def init(self):
|
||||
self.db = dataset.connect('sqlite:///database.db')
|
||||
|
||||
self.cmd['bake'] = bake
|
||||
self.cmd['cheat'] = cheat
|
||||
self.cmd['inv'] = invsee
|
||||
self.cmd['items'] = invsee
|
||||
self.cmd['goods'] = invsee
|
||||
self.cmd['purge'] = purge
|
||||
self.cmd['give'] = give
|
||||
|
||||
self.help['bake'] = ['bake <item> - bake some stuff', 'dont dirty the oven!']
|
||||
self.help['cheat'] = ['cheat <user> <item> - you are bad if you use it', 'bad bad bad bad']
|
||||
self.help['items'] = ['items [user] - show the stuff in your inventory (more for aliases)', 'aliases for items include: inv, goods']
|
||||
self.help['purge'] = ['purge <user> - clear their inv lel', 'nooo admin abuse im calling the cops']
|
||||
self.help['give'] = ['give <user> <item> - give someone something from your inventory', 'thats very nice of you!']
|
||||
|
||||
self.raw['genGoods'] = generate
|
||||
|
||||
self.bakedGoods = {
|
||||
'cheese': 50,
|
||||
'wheat': 1,
|
||||
'turd': 0,
|
||||
'flour': 10,
|
||||
'bread': 30,
|
||||
'crispy': 15,
|
||||
'tortilla': 35,
|
||||
'egg': 20,
|
||||
'bird': 32,
|
||||
'erotic': 69,
|
||||
'phallic': 65,
|
||||
'pizza': 34,
|
||||
'hairball': 6,
|
||||
'cookie': 44,
|
||||
'pancake': 12,
|
||||
'rice': 29,
|
||||
'mess': 14,
|
||||
'sandwich':55,
|
||||
'wafer': 56,
|
||||
'pi': 31,
|
||||
'fbi': 80
|
||||
}
|
||||
self.bakedPrice = dict((v,k) for k,v in self.bakedGoods.items())
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
|
||||
|
||||
async def helpParse(self, c, n, m):
|
||||
if m in self.help:
|
||||
self.more[c] = self.help[m][1]
|
||||
await self.message(c, self.help[m][0])
|
||||
else:
|
||||
await self.message(c, 'my main 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:
|
||||
await self.message(c, self.more.pop(c))
|
||||
return
|
||||
else:
|
||||
await self.message(c, 'what more could you want?')
|
||||
|
||||
|
||||
async def init(self):
|
||||
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={}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
import asyncio
|
||||
|
||||
async def run(cmd):
|
||||
proc = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE)
|
||||
|
||||
stdout, stderr = await proc.communicate()
|
||||
|
||||
print(f'[{cmd!r} exited with {proc.returncode}]')
|
||||
if stdout:
|
||||
return stdout.decode()
|
||||
if stderr:
|
||||
#print(f'[markov stderr]\n{stderr.decode()}')
|
||||
return
|
||||
|
||||
|
||||
|
||||
async def markov(self, c, n, m):
|
||||
m = ''.join([i for i in m if i.isalnum()])
|
||||
if len(m) > 0:
|
||||
await self.message(c, (await run("markov '{}'".format(m)))[:-1])
|
||||
return
|
||||
await self.message(c, 'the oven went boop')
|
||||
|
||||
async def init(self):
|
||||
self.cmd['m'] = markov
|
||||
self.cmd['markov'] = markov
|
||||
self.help['markov'] = ["markov <seed> - generate markov chains", "https://en.wikipedia.org/wiki/Markov_chain"]
|
||||
|
||||
|
||||
|
||||
|
||||
|
12
modules/nlp.py
Normal file
12
modules/nlp.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
import dataset
|
||||
import random
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async def init(self):
|
||||
self.db = dataset.connect('sqlite:///database.db')
|
||||
|
Loading…
Reference in a new issue