cleaning up

This commit is contained in:
NikolajDanger
2020-03-23 22:34:53 +01:00
parent 775f3fe0c7
commit bc7048d493
21 changed files with 1234 additions and 691 deletions

View File

@ -3,11 +3,7 @@ import asyncio
import pickle
import time
from GwendolynFuncs import roll_dice, helloFunc, imageFunc, movieFunc, cap
from lookupFuncs import monsterFunc, spellFunc
from generators import nameGen, tavernGen
from swroll import parseRoll
from swchar import parseChar
from funcs import gwendolynFuncs
client = discord.Client()
@ -32,26 +28,25 @@ async def on_message(message):
if message.content.lower().startswith("!hello"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !hello")
await message.channel.send(helloFunc(message.author.name))
await message.channel.send(gwendolynFuncs.helloFunc(message.author.name))
elif message.content.lower().startswith("!roll"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !roll")
if message.content.lower() == "!roll" or message.content.lower() == "!roll ":
print(roll_dice(message.author.name))
await message.channel.send(roll_dice(message.author.name))
await message.channel.send(gwendolynFuncs.roll_dice(message.author.name))
else:
await message.channel.send(roll_dice(message.author.name, message.content.lower().replace("!roll","")))
await message.channel.send(gwendolynFuncs.roll_dice(message.author.name, message.content.lower().replace("!roll","")))
elif message.content.lower().startswith("!spell "):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !spell")
await message.channel.send(spellFunc(message.content))
await message.channel.send(gwendolynFuncs.spellFunc(message.content))
elif message.content.lower().startswith("!monster "):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !monster")
title, text1, text2, text3, text4, text5 = monsterFunc(message.content)
title, text1, text2, text3, text4, text5 = gwendolynFuncs.monsterFunc(message.content)
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
await message.channel.send(embed = em1)
if text2 != "":
@ -99,13 +94,13 @@ async def on_message(message):
elif message.content.lower().startswith("!image"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !image")
await message.channel.send(imageFunc())
await message.channel.send(gwendolynFuncs.imageFunc())
elif message.content.lower().startswith("!movie"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !movie")
async with message.channel.typing():
title, plot, cover, cast = movieFunc()
title, plot, cover, cast = gwendolynFuncs.movieFunc()
if title == "error":
await message.channel.send("An error occurred. Try again")
else:
@ -117,15 +112,15 @@ async def on_message(message):
elif message.content.lower().startswith("!name"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !name")
await message.channel.send(nameGen())
await message.channel.send(gwendolynFuncs.nameGen())
elif message.content.lower().startswith("!tavern"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !tavern")
await message.channel.send(tavernGen())
await message.channel.send(gwendolynFuncs.tavernGen())
elif message.content.lower().startswith("!game "):
gamePlaying = cap(message.content.lower().replace("!game ",""))
gamePlaying = gwendolynFuncs.cap(message.content.lower().replace("!game ",""))
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
game = discord.Game(gamePlaying)
@ -134,14 +129,14 @@ async def on_message(message):
elif message.content.lower().startswith("!swroll"):
localtime = time.asctime( time.localtime(time.time()) )
print("\n"+localtime+"\n"+message.author.name+" ran !swroll")
command = cap(message.content.lower().replace("!swroll",""))
await message.channel.send(parseRoll(message.author.name,command))
command = gwendolynFuncs.cap(message.content.lower().replace("!swroll",""))
await message.channel.send(gwendolynFuncs.parseRoll(message.author.name,command))
elif message.content.lower().startswith("!swchar"):
localtime = time.asctime(time.localtime(time.time()))
print("\n"+localtime+"\n"+message.author.name+" ran !swchar")
command = cap(message.content.lower().replace("!swchar",""))
title, desc = parseChar(message.author.name,command)
command = gwendolynFuncs.cap(message.content.lower().replace("!swchar",""))
title, desc = gwendolynFuncs.parseChar(message.author.name,command)
if title != "":
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
await message.channel.send(embed = em1)