More logging
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,10 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
funcs/__pycache__/
|
||||
funcs/lookup/__pycache__/
|
||||
funcs/other/__pycache__/
|
||||
funcs/roll/__pycache__/
|
||||
funcs/swfuncs/__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
|
@ -9,7 +9,7 @@ import codecs
|
||||
|
||||
import funcs
|
||||
|
||||
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
|
||||
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
||||
|
||||
with open("token.txt","r") as f:
|
||||
token =f.read()
|
||||
@ -40,7 +40,10 @@ async def on_message(message):
|
||||
em = discord.Embed(title = "Help", description = text,colour = 0x59f442)
|
||||
await message.channel.send(embed = em)
|
||||
|
||||
if message.content.lower().startswith("!hello"):
|
||||
elif message.content.lower().startswith("!stop"):
|
||||
await client.logout()
|
||||
|
||||
elif message.content.lower().startswith("!hello"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print("\n"+localtime+"\n"+message.author.name+" ran !hello")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !hello")
|
||||
|
@ -1,10 +1,11 @@
|
||||
import math
|
||||
import discord
|
||||
import json
|
||||
import logging
|
||||
|
||||
from funcs import gwendolynFuncs as gf
|
||||
|
||||
|
||||
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
|
||||
|
||||
def modifier(statistic):
|
||||
mods = math.floor((statistic-10)/2)
|
||||
@ -18,15 +19,17 @@ abilities = ["acrobatics","animal_handling","arcana","athletics","deception","hi
|
||||
def monsterFunc(content):
|
||||
command = gf.cap(content.lower().replace("!monster ",""))
|
||||
print("Looking up "+command)
|
||||
logging.info("Looking up "+command)
|
||||
if len(content.lower().split()) < 2:
|
||||
print("Monster doesn't exist in database")
|
||||
print("")
|
||||
print("Monster doesn't exist in database\n")
|
||||
logging.info("Monster doesn't exist in database\n")
|
||||
return("I don't know that monster...","","","","","")
|
||||
else:
|
||||
data = json.load(open('funcs/lookup/monsters.json', encoding = "utf8"))
|
||||
for monster in data:
|
||||
print("Found it!")
|
||||
if str(command) == monster["name"]:
|
||||
print("Found it!")
|
||||
logging.info("Found it!")
|
||||
if monster["subtype"] != "":
|
||||
typs = (monster["type"]+" ("+monster["subtype"]+")")
|
||||
else:
|
||||
@ -104,8 +107,8 @@ def monsterFunc(content):
|
||||
text3 = (act)
|
||||
text4 = (react)
|
||||
text5 = (leg_act)
|
||||
print("Returning monster information")
|
||||
print("")
|
||||
print("Returning monster information\n")
|
||||
logging.info("Returning monster information\n")
|
||||
return(str(command),text1,text2,text3,text4,text5)
|
||||
print("")
|
||||
return("I don't know that monster...","","","","","")
|
||||
@ -113,12 +116,16 @@ def monsterFunc(content):
|
||||
def spellFunc(content):
|
||||
command = gf.cap(content.lower().replace("!spell ",""))
|
||||
print("Looking up "+command)
|
||||
logging.info("Looking up "+command)
|
||||
data = json.load(open('funcs/lookup/spells.json', encoding = "utf8"))
|
||||
if str(command) in data:
|
||||
print("Returning spell information")
|
||||
logging.info("Returning spell information")
|
||||
spell_output = ("***"+str(command)+"***\n*"+str(data[str(command)]["level"])+" level "+str(data[str(command)]["school"])+"\nCasting Time: "+str(data[str(command)]["casting_time"])+"\nRange: "+str(data[str(command)]["range"])+"\nComponents: "+str(data[str(command)]["components"])+"\nDuration: "+str(data[str(command)]["duration"])+"*\n \n"+str(data[str(command)]["description"]))
|
||||
else:
|
||||
print("I don't know that spell")
|
||||
logging.info("I don't know that spell")
|
||||
spell_output = "I don't think that's a spell"
|
||||
print("Successfully ran !spell")
|
||||
logging.info("Successfully ran !spell")
|
||||
return(spell_output)
|
||||
|
Reference in New Issue
Block a user