Let's try again

This commit is contained in:
NikolajDanger
2020-03-22 17:42:30 +01:00
parent 406b0f77c5
commit 58f9cc9fa7
2 changed files with 24 additions and 16 deletions

View File

@ -24,19 +24,19 @@ async def on_ready():
async def on_message(message):
if message.content.lower().startswith("!help"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !help\n")
print("\n"+localtime+"\n"+message.author.name+" ran !help\n")
file = open("help.txt","r")
em = discord.Embed(title = "Help", description = file.read(),colour = 0x59f442)
await message.channel.send(embed = em)
if message.content.lower().startswith("!hello"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !hello")
print("\n"+localtime+"\n"+message.author.name+" ran !hello")
await message.channel.send(helloFunc(message.author.name))
elif message.content.lower().startswith("!roll"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !roll")
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))
@ -45,12 +45,12 @@ async def on_message(message):
elif message.content.lower().startswith("!spell "):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !spell")
print("\n"+localtime+"\n"+message.author.name+" ran !spell")
await message.channel.send(spellFunc(message.content))
elif message.content.lower().startswith("!monster "):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !monster")
print("\n"+localtime+"\n"+message.author.name+" ran !monster")
title, text1, text2, text3, text4, text5 = monsterFunc(message.content)
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
await message.channel.send(embed = em1)
@ -93,17 +93,17 @@ async def on_message(message):
elif message.content.lower().startswith("!map"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !map")
print("\n"+localtime+"\n"+message.author.name+" ran !map")
await message.channel.send("https://i.imgur.com/diMXXJs.jpg")
elif message.content.lower().startswith("!image"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !image")
print("\n"+localtime+"\n"+message.author.name+" ran !image")
await message.channel.send(imageFunc())
elif message.content.lower().startswith("!movie"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !movie")
print("\n"+localtime+"\n"+message.author.name+" ran !movie")
async with message.channel.typing():
title, plot, cover, cast = movieFunc()
if title == "error":
@ -116,32 +116,38 @@ async def on_message(message):
elif message.content.lower().startswith("!name"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !name")
print("\n"+localtime+"\n"+message.author.name+" ran !name")
await message.channel.send(nameGen())
elif message.content.lower().startswith("!tavern"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !tavern")
print("\n"+localtime+"\n"+message.author.name+" ran !tavern")
await message.channel.send(tavernGen())
elif message.content.lower().startswith("!game "):
gamePlaying = cap(message.content.lower().replace("!game ",""))
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
print("\n"+localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
game = discord.Game(gamePlaying)
await client.change_presence(activity=game)
elif message.content.lower().startswith("!swroll"):
localtime = time.asctime( time.localtime(time.time()) )
print(localtime+"\n"+message.author.name+" ran !swroll")
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))
elif message.content.lower().startswith("!swchar"):
localtime = time.asctime(time.localtime(time.time()))
print(localtime+"\n"+message.author.name+" ran !swchar")
print("\n"+localtime+"\n"+message.author.name+" ran !swchar")
command = cap(message.content.lower().replace("!swchar",""))
await message.channel.send(parseChar(message.author.name,command))
title, desc = parseChar(message.author.name,command)
if title != "":
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
await message.channel.send(embed = em1)
else:
await message.channel.send(desc)
client.run("MzgwNzI4OTkwMTEwODQyODgx.DO81GQ.rctkEQtieciETXnmsYbwZvvOkaA")

View File

@ -72,7 +72,7 @@ def lookUp(data : dict, key : str, cmd : str = ""):
return key + " doesn't exist"
def characterSheet(character : dict):
return "```**"+character["Name"]+"**\nSpecies: "+character["Species"]+"\nCareer: "+character["Career"]+"```"
return character["Name"]+"Species: "+character["Species"]+"\nCareer: "+character["Career"]
def charData(user : str,cmd : str):
with open("characters.json", "r") as f:
@ -157,7 +157,9 @@ def parseChar(user : str, cmd : str):
data[user] = newChar
with open("characters.json", "w") as f:
json.dump(data,f,indent = 4)
return "Character for " + user + " created"
return "", "Character for " + user + " created"
else:
return "", charData(user,cmd)
def lightsaberChar(user : str):
with open("characters.json", "r") as f: