some cleaning up
This commit is contained in:
@ -15,9 +15,10 @@ class Generators():
|
||||
yield (corpus[i], corpus[i+1], corpus[i+2])
|
||||
|
||||
# Generates a random name
|
||||
async def nameGen(self, ctx):
|
||||
async def name_gen(self, ctx):
|
||||
# Makes a list of all names from "names.txt"
|
||||
names = open('gwendolyn/resources/names.txt', encoding='utf8').read()
|
||||
with open("gwendolyn/resources/names.txt", "r", encoding='utf8') as file_pointer:
|
||||
names = file_pointer.read()
|
||||
corpus = list(names)
|
||||
|
||||
# Makes a list of pairs
|
||||
@ -28,13 +29,13 @@ class Generators():
|
||||
|
||||
# Makes a dictionary of all letters that come after all other letters
|
||||
for letter_1, letter_2 in pairs:
|
||||
if letter_1 in letter_dict.keys():
|
||||
if letter_1 in letter_dict:
|
||||
letter_dict[letter_1].append(letter_2)
|
||||
else:
|
||||
letter_dict[letter_1] = [letter_2]
|
||||
|
||||
for letter_1, letter_2, letter_3 in triplets:
|
||||
if letter_1+letter_2 in letter_dict.keys():
|
||||
if letter_1+letter_2 in letter_dict:
|
||||
letter_dict[letter_1+letter_2].append(letter_3)
|
||||
else:
|
||||
letter_dict[letter_1+letter_2] = [letter_3]
|
||||
@ -60,7 +61,7 @@ class Generators():
|
||||
done = False
|
||||
|
||||
# Creates the name one letter at a time
|
||||
while done == False:
|
||||
while not done:
|
||||
if random.randint(1,10) > 1:
|
||||
try:
|
||||
new_letter = random.choice(letter_dict[chain[-2]+chain[-1]])
|
||||
@ -79,15 +80,15 @@ class Generators():
|
||||
await ctx.send(gen_name)
|
||||
|
||||
# Generates a random tavern name
|
||||
async def tavernGen(self, ctx):
|
||||
async def tavern_gen(self, ctx):
|
||||
# _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"]
|
||||
tp = [" Tavern"," Inn","","","","","","","","",""]
|
||||
first_part = ["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"]
|
||||
second_part = ["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"]
|
||||
third_part = [" Tavern"," Inn","","","","","","","","",""]
|
||||
|
||||
# Picks one of each
|
||||
genTav = random.choice(fp)+" "+random.choice(sp)+random.choice(tp)
|
||||
self.bot.log("Generated "+genTav)
|
||||
gen_tav = random.choice(first_part)+" "+random.choice(second_part)+random.choice(third_part)
|
||||
self.bot.log("Generated "+gen_tav)
|
||||
|
||||
# Return the name
|
||||
await ctx.send(genTav)
|
||||
await ctx.send(gen_tav)
|
||||
|
Reference in New Issue
Block a user