Made the whole thing work
This commit is contained in:
39
Gwendolyn.py
39
Gwendolyn.py
@ -1,10 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import discord
|
||||
import asyncio
|
||||
import pickle
|
||||
import time
|
||||
import logging
|
||||
import codecs
|
||||
|
||||
from funcs import gwendolynFuncs
|
||||
import funcs
|
||||
|
||||
logging.basicConfig(filename="logfilename.log", level=logging.INFO)
|
||||
client = discord.Client()
|
||||
@ -27,36 +30,38 @@ async def on_message(message):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !help")
|
||||
file = open("help.txt","r")
|
||||
em = discord.Embed(title = "Help", description = file.read(),colour = 0x59f442)
|
||||
with codecs.open("help.txt",encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
print(text)
|
||||
em = discord.Embed(title = "Help", description = text,colour = 0x59f442)
|
||||
await message.channel.send(embed = em)
|
||||
|
||||
if 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")
|
||||
await message.channel.send(gwendolynFuncs.helloFunc(message.author.name))
|
||||
await message.channel.send(funcs.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")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !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(funcs.roll_dice(message.author.name))
|
||||
else:
|
||||
await message.channel.send(gwendolynFuncs.roll_dice(message.author.name, message.content.lower().replace("!roll","")))
|
||||
await message.channel.send(funcs.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")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !spell")
|
||||
await message.channel.send(gwendolynFuncs.spellFunc(message.content))
|
||||
await message.channel.send(funcs.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")
|
||||
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 = funcs.monsterFunc(message.content)
|
||||
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em1)
|
||||
if text2 != "":
|
||||
@ -106,14 +111,14 @@ async def on_message(message):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
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(funcs.imageFunc())
|
||||
|
||||
elif message.content.lower().startswith("!movie"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
print("\n"+localtime+"\n"+message.author.name+" ran !movie")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !movie")
|
||||
async with message.channel.typing():
|
||||
title, plot, cover, cast = gwendolynFuncs.movieFunc()
|
||||
title, plot, cover, cast = funcs.movieFunc()
|
||||
if title == "error":
|
||||
await message.channel.send("An error occurred. Try again")
|
||||
else:
|
||||
@ -126,16 +131,16 @@ async def on_message(message):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
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(funcs.nameGen())
|
||||
|
||||
elif message.content.lower().startswith("!tavern"):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
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(funcs.tavernGen())
|
||||
|
||||
elif message.content.lower().startswith("!game "):
|
||||
gamePlaying = gwendolynFuncs.cap(message.content.lower().replace("!game ",""))
|
||||
gamePlaying = funcs.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+"'")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !game, changing the game to '"+gamePlaying+"'")
|
||||
@ -146,15 +151,15 @@ async def on_message(message):
|
||||
localtime = time.asctime( time.localtime(time.time()) )
|
||||
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",""))
|
||||
await message.channel.send(gwendolynFuncs.parseRoll(message.author.name,command))
|
||||
command = funcs.cap(message.content.lower().replace("!swroll",""))
|
||||
await message.channel.send(funcs.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")
|
||||
logging.info("\n"+localtime+"\n"+message.author.name+" ran !swchar")
|
||||
command = gwendolynFuncs.cap(message.content.lower().replace("!swchar",""))
|
||||
title, desc = gwendolynFuncs.parseChar(message.author.name,command)
|
||||
command = funcs.cap(message.content.lower().replace("!swchar",""))
|
||||
title, desc = funcs.parseChar(message.author.name,command)
|
||||
if title != "":
|
||||
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em1)
|
||||
|
Reference in New Issue
Block a user