Maintinance 🔧
This commit is contained in:
@ -2,7 +2,7 @@ import discord, os, finnhub
|
||||
|
||||
from discord.ext import commands
|
||||
from pymongo import MongoClient
|
||||
from funcs import logThis, makeFiles, Money, Funcs, SwChar, SwDestiny, SwRoll, Games
|
||||
from funcs import logThis, makeFiles, Money, Funcs, SwChar, SwDestiny, SwRoll, Games, Generators
|
||||
|
||||
commandPrefix = "!"
|
||||
|
||||
@ -43,6 +43,8 @@ class Gwendolyn(commands.Bot):
|
||||
self.swroll = SwRoll(self)
|
||||
self.swdestiny = SwDestiny(self)
|
||||
|
||||
self.generator = Generators()
|
||||
|
||||
Games(self)
|
||||
|
||||
self.money = Money(self)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import discord, codecs, string, wolframalpha, requests, os
|
||||
from discord.ext import commands
|
||||
|
||||
from funcs import logThis, helloFunc, roll_dice, imageFunc, nameGen, tavernGen, movieFunc, cap, findWikiPage
|
||||
from funcs import logThis, helloFunc, roll_dice, imageFunc, movieFunc, cap, findWikiPage
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
class MiscCog(commands.Cog):
|
||||
@ -10,6 +10,7 @@ class MiscCog(commands.Cog):
|
||||
"""Runs misc commands."""
|
||||
self.client = client
|
||||
self.client.remove_command("help")
|
||||
self.generator = client.generator
|
||||
|
||||
@commands.command(name = "help")
|
||||
async def helpCommand(self, ctx, *, content = ""):
|
||||
@ -88,12 +89,12 @@ class MiscCog(commands.Cog):
|
||||
# Generates a random name
|
||||
@commands.command()
|
||||
async def name(self, ctx):
|
||||
await ctx.send(nameGen())
|
||||
await ctx.send(self.generator.nameGen())
|
||||
|
||||
# Generates a random tavern name
|
||||
@commands.command()
|
||||
async def tavern(self, ctx):
|
||||
await ctx.send(tavernGen())
|
||||
await ctx.send(self.generator.tavernGen())
|
||||
|
||||
# Sets the game Gwendolyn's playing
|
||||
@commands.command()
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""A collection of all Gwendolyn functions."""
|
||||
|
||||
__all__ = ["Games" ,"helloFunc", "cap", "imageFunc", "logThis", "findWikiPage", "makeFiles", "emojiToCommand", "Money", "spellFunc", "monsterFunc", "nameGen", "tavernGen", "movieFunc", "roll_dice", "SwChar", "SwDestiny", "SwRoll", "replaceMultiple","Funcs"]
|
||||
__all__ = ["Games" ,"helloFunc", "cap", "imageFunc", "logThis", "findWikiPage", "makeFiles", "emojiToCommand", "Money", "spellFunc", "monsterFunc", "Generators", "movieFunc", "roll_dice", "SwChar", "SwDestiny", "SwRoll", "replaceMultiple","Funcs"]
|
||||
|
||||
from .miscFuncs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, replaceMultiple, emojiToCommand
|
||||
|
||||
@ -10,7 +10,7 @@ from .games import Money, Games
|
||||
|
||||
from .lookup import spellFunc, monsterFunc
|
||||
|
||||
from .other import nameGen, tavernGen, movieFunc
|
||||
from .other import Generators, movieFunc
|
||||
|
||||
from .roll import roll_dice
|
||||
|
||||
|
@ -77,14 +77,14 @@ class Werewolf():
|
||||
channel = "#"+str(ctx.channel.id)
|
||||
if round == 0:
|
||||
await asyncio.sleep(120)
|
||||
|
||||
game = self.bot.database["werewolf games"].find_one({"_id":channel})
|
||||
AINumber = 1
|
||||
while len(game["users"].keys()) >= minimumPlayers and len(game["users"].keys()) < minimumPlayersWithAI:
|
||||
user = {"role": None}
|
||||
self.bot.database["werewolf games"].update_one({"_id":"#"+str(ctx.channel.id)},
|
||||
{"$set":{"users."+str(AINumber):user}})
|
||||
{"$set":{"users."+self.bot.generator.nameGen():user}})
|
||||
game = self.bot.database["werewolf games"].find_one({"_id":channel})
|
||||
AINumber += 1
|
||||
|
||||
self.bot.database["werewolf games"].update_one({"_id":channel},{"$inc":{"round":1}})
|
||||
await self.werewolfLoop(ctx,round+1)
|
||||
else:
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Misc. functions for Gwendolyn."""
|
||||
|
||||
__all__ = ["nameGen", "tavernGen", "movieFunc"]
|
||||
__all__ = ["Generators", "movieFunc"]
|
||||
|
||||
from .generators import nameGen, tavernGen
|
||||
from .generators import Generators
|
||||
from .movie import movieFunc
|
@ -3,25 +3,26 @@ import random
|
||||
|
||||
from funcs import logThis
|
||||
|
||||
class Generators():
|
||||
# Returns a list of all letter pairs in the text
|
||||
def make_pairs(corpus):
|
||||
def make_pairs(self, corpus):
|
||||
for i in range(len(corpus)-1):
|
||||
yield (corpus[i], corpus[i+1])
|
||||
|
||||
# Returns a list of all letter triplets in the text
|
||||
def make_triplets(corpus):
|
||||
def make_triplets(self, corpus):
|
||||
for i in range(len(corpus)-2):
|
||||
yield (corpus[i], corpus[i+1], corpus[i+2])
|
||||
|
||||
# Generates a random name
|
||||
def nameGen():
|
||||
def nameGen(self):
|
||||
# Makes a list of all names from "names.txt"
|
||||
names = open('resources/names.txt', encoding='utf8').read()
|
||||
corpus = list(names)
|
||||
|
||||
# Makes a list of pairs
|
||||
pairs = make_pairs(corpus)
|
||||
triplets = make_triplets(corpus)
|
||||
pairs = self.make_pairs(corpus)
|
||||
triplets = self.make_triplets(corpus)
|
||||
|
||||
letter_dict = {}
|
||||
|
||||
@ -77,7 +78,7 @@ def nameGen():
|
||||
return(genName)
|
||||
|
||||
# Generates a random tavern name
|
||||
def tavernGen():
|
||||
def tavernGen(self):
|
||||
# Lists first parts, second parts and third parts of tavern names
|
||||
fp = ["The Silver","The Golden","The Staggering","The Laughing","The Prancing","The Gilded","The Running","The Howling","The Slaughtered","The Leering","The Drunken","The Leaping","The Roaring","The Frowning","The Lonely","The Wandering","The Mysterious","The Barking","The Black","The Gleaming","The Tap-Dancing","The Sad","The Sexy","The Artificial","The Groovy","The Merciful","The Confused","The Pouting","The Horny","The Okay","The Friendly","The Hungry","The Handicapped","The Fire-breathing","The One-Eyed","The Psychotic","The Mad","The Evil","The Idiotic","The Trusty","The Busty"]
|
||||
sp = ["Eel","Dolphin","Dwarf","Pegasus","Pony","Rose","Stag","Wolf","Lamb","Demon","Goat","Spirit","Horde","Jester","Mountain","Eagle","Satyr","Dog","Spider","Star","Dad","Rat","Jeremy","Mouse","Unicorn","Pearl","Ant","Crab","Penguin","Octopus","Lawyer","Ghost","Toad","Handjob","Immigrant","SJW","Dragon","Bard","Sphinx","Soldier","Salmon","Owlbear","Kite","Frost Giant","Arsonist"]
|
||||
|
Reference in New Issue
Block a user