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