Logging
This commit is contained in:
20
Gwendolyn.py
20
Gwendolyn.py
@ -2,17 +2,22 @@ import discord
|
|||||||
import asyncio
|
import asyncio
|
||||||
import pickle
|
import pickle
|
||||||
import time
|
import time
|
||||||
|
import logging
|
||||||
|
|
||||||
from funcs import gwendolynFuncs
|
from funcs import gwendolynFuncs
|
||||||
|
|
||||||
|
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
|
print(localtime)
|
||||||
print("Logged in as")
|
print("Logged in as")
|
||||||
print(client.user.name)
|
print(client.user.name)
|
||||||
print(client.user.id)
|
print(client.user.id)
|
||||||
print("-----------")
|
print("-----------")
|
||||||
|
logging.info("\n-----------\n"+localtime+"\nLogged in")
|
||||||
game = discord.Game("Some weeb shit")
|
game = discord.Game("Some weeb shit")
|
||||||
await client.change_presence(activity=game)
|
await client.change_presence(activity=game)
|
||||||
|
|
||||||
@ -20,7 +25,8 @@ async def on_ready():
|
|||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
if message.content.lower().startswith("!help"):
|
if message.content.lower().startswith("!help"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !help\n")
|
print("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||||
file = open("help.txt","r")
|
file = open("help.txt","r")
|
||||||
em = discord.Embed(title = "Help", description = file.read(),colour = 0x59f442)
|
em = discord.Embed(title = "Help", description = file.read(),colour = 0x59f442)
|
||||||
await message.channel.send(embed = em)
|
await message.channel.send(embed = em)
|
||||||
@ -28,11 +34,13 @@ async def on_message(message):
|
|||||||
if message.content.lower().startswith("!hello"):
|
if 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")
|
||||||
await message.channel.send(gwendolynFuncs.helloFunc(message.author.name))
|
await message.channel.send(gwendolynFuncs.helloFunc(message.author.name))
|
||||||
|
|
||||||
elif message.content.lower().startswith("!roll"):
|
elif message.content.lower().startswith("!roll"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !roll")
|
print("\n"+localtime+"\n"+message.author.name+" ran !roll")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !roll")
|
||||||
if message.content.lower() == "!roll" or message.content.lower() == "!roll ":
|
if message.content.lower() == "!roll" or message.content.lower() == "!roll ":
|
||||||
await message.channel.send(gwendolynFuncs.roll_dice(message.author.name))
|
await message.channel.send(gwendolynFuncs.roll_dice(message.author.name))
|
||||||
else:
|
else:
|
||||||
@ -41,11 +49,13 @@ async def on_message(message):
|
|||||||
elif message.content.lower().startswith("!spell "):
|
elif message.content.lower().startswith("!spell "):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !spell")
|
print("\n"+localtime+"\n"+message.author.name+" ran !spell")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !spell")
|
||||||
await message.channel.send(gwendolynFuncs.spellFunc(message.content))
|
await message.channel.send(gwendolynFuncs.spellFunc(message.content))
|
||||||
|
|
||||||
elif message.content.lower().startswith("!monster "):
|
elif message.content.lower().startswith("!monster "):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !monster")
|
print("\n"+localtime+"\n"+message.author.name+" ran !monster")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !monster")
|
||||||
title, text1, text2, text3, text4, text5 = gwendolynFuncs.monsterFunc(message.content)
|
title, text1, text2, text3, text4, text5 = gwendolynFuncs.monsterFunc(message.content)
|
||||||
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
||||||
await message.channel.send(embed = em1)
|
await message.channel.send(embed = em1)
|
||||||
@ -89,16 +99,19 @@ async def on_message(message):
|
|||||||
elif message.content.lower().startswith("!map"):
|
elif message.content.lower().startswith("!map"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !map")
|
print("\n"+localtime+"\n"+message.author.name+" ran !map")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !map")
|
||||||
await message.channel.send("https://i.imgur.com/diMXXJs.jpg")
|
await message.channel.send("https://i.imgur.com/diMXXJs.jpg")
|
||||||
|
|
||||||
elif message.content.lower().startswith("!image"):
|
elif message.content.lower().startswith("!image"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !image")
|
print("\n"+localtime+"\n"+message.author.name+" ran !image")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !image")
|
||||||
await message.channel.send(gwendolynFuncs.imageFunc())
|
await message.channel.send(gwendolynFuncs.imageFunc())
|
||||||
|
|
||||||
elif message.content.lower().startswith("!movie"):
|
elif message.content.lower().startswith("!movie"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !movie")
|
print("\n"+localtime+"\n"+message.author.name+" ran !movie")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !movie")
|
||||||
async with message.channel.typing():
|
async with message.channel.typing():
|
||||||
title, plot, cover, cast = gwendolynFuncs.movieFunc()
|
title, plot, cover, cast = gwendolynFuncs.movieFunc()
|
||||||
if title == "error":
|
if title == "error":
|
||||||
@ -112,29 +125,34 @@ async def on_message(message):
|
|||||||
elif message.content.lower().startswith("!name"):
|
elif message.content.lower().startswith("!name"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !name")
|
print("\n"+localtime+"\n"+message.author.name+" ran !name")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !name")
|
||||||
await message.channel.send(gwendolynFuncs.nameGen())
|
await message.channel.send(gwendolynFuncs.nameGen())
|
||||||
|
|
||||||
elif message.content.lower().startswith("!tavern"):
|
elif message.content.lower().startswith("!tavern"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !tavern")
|
print("\n"+localtime+"\n"+message.author.name+" ran !tavern")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !tavern")
|
||||||
await message.channel.send(gwendolynFuncs.tavernGen())
|
await message.channel.send(gwendolynFuncs.tavernGen())
|
||||||
|
|
||||||
elif message.content.lower().startswith("!game "):
|
elif message.content.lower().startswith("!game "):
|
||||||
gamePlaying = gwendolynFuncs.cap(message.content.lower().replace("!game ",""))
|
gamePlaying = gwendolynFuncs.cap(message.content.lower().replace("!game ",""))
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+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+"'")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
|
||||||
game = discord.Game(gamePlaying)
|
game = discord.Game(gamePlaying)
|
||||||
await client.change_presence(activity=game)
|
await client.change_presence(activity=game)
|
||||||
|
|
||||||
elif message.content.lower().startswith("!swroll"):
|
elif message.content.lower().startswith("!swroll"):
|
||||||
localtime = time.asctime( time.localtime(time.time()) )
|
localtime = time.asctime( time.localtime(time.time()) )
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !swroll")
|
print("\n"+localtime+"\n"+message.author.name+" ran !swroll")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !swroll")
|
||||||
command = gwendolynFuncs.cap(message.content.lower().replace("!swroll",""))
|
command = gwendolynFuncs.cap(message.content.lower().replace("!swroll",""))
|
||||||
await message.channel.send(gwendolynFuncs.parseRoll(message.author.name,command))
|
await message.channel.send(gwendolynFuncs.parseRoll(message.author.name,command))
|
||||||
|
|
||||||
elif message.content.lower().startswith("!swchar"):
|
elif message.content.lower().startswith("!swchar"):
|
||||||
localtime = time.asctime(time.localtime(time.time()))
|
localtime = time.asctime(time.localtime(time.time()))
|
||||||
print("\n"+localtime+"\n"+message.author.name+" ran !swchar")
|
print("\n"+localtime+"\n"+message.author.name+" ran !swchar")
|
||||||
|
logging.info("\n"+localtime+"\n"+message.author.name+" ran !swchar")
|
||||||
command = gwendolynFuncs.cap(message.content.lower().replace("!swchar",""))
|
command = gwendolynFuncs.cap(message.content.lower().replace("!swchar",""))
|
||||||
title, desc = gwendolynFuncs.parseChar(message.author.name,command)
|
title, desc = gwendolynFuncs.parseChar(message.author.name,command)
|
||||||
if title != "":
|
if title != "":
|
||||||
|
Reference in New Issue
Block a user