diff --git a/Gwendolyn.py b/Gwendolyn.py index 74357b5..4f590d8 100644 --- a/Gwendolyn.py +++ b/Gwendolyn.py @@ -1,54 +1,52 @@ -# -*- coding: utf-8 -*- - -import discord -import asyncio -#import pickle -import codecs -import string -import json -import random -#import math -import os +import discord, os from discord.ext import commands -from funcs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, emojiToCommand, fiarReactionTest, deleteGame, stopServer, checkBalance, giveMoney, triviaCountPoints, triviaStart, triviaAnswer, blackjackShuffle, blackjackStart, blackjackPlayerDrawHand, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble, blackjackSplit, parseFourInARow, fourInARowAI, spellFunc, monsterFunc, nameGen, tavernGen, movieFunc, roll_dice, parseChar, parseRoll, critRoll, parseDestiny, parseHex, addToDict, monopolyReactionTest +from funcs import logThis, makeFiles -from gameLoops import fiar, blackjackLoop, runHex, runMonopoly +commandPrefix = "!" +client = commands.Bot(command_prefix=commandPrefix) -# Blackjack shuffle variables -blackjackMinCards = 50 -blackjackDecks = 4 +# Logs in +@client.event +async def on_ready(): + logThis("Logged in as "+client.user.name+", "+str(client.user.id)) + game = discord.Game("Some weeb shit") + await client.change_presence(activity=game) -async def parseCommands(message,content): +# Loads and unloads cogs - # Runs a game of four in a row - elif content.startswith("fourinarow"): - try: - command = content.replace("fourinarow","") - await fiar(message.channel,command,"#"+str(message.author.id)) - except: - logThis("Something went wrong (error code 1400)") +@client.command() +async def load(ctx,extension): + client.load_extension(f"cogs.{extension}") - # Runs a game of Hex - elif content.startswith("hex"): - try: - command = content.replace("hex","") - await runHex(message.channel,command,"#"+str(message.author.id)) - except: - logThis("Something went wrong (error code 1500)") - - # Runs a game of monopoly - elif content.startswith("monopoly"): - try: - command = content.replace("monopoly","",1) - await runMonopoly(message.channel,command,"#"+str(message.author.id)) - except: - logThis("Something went wrong (error code 1600)") - - # Not a command +@client.command() +async def unload(ctx,extension): + client.unload_extension(f"cogs.{extension}") + +@client.event +async def on_command(ctx): + logThis(f"{ctx.message.author.display_name} ran {ctx.message.content}") + +# Logs if a command experiences an error +@client.event +async def on_command_error(ctx, error): + if isinstance(error, commands.CommandNotFound): + await ctx.send("That's not a command (error code 001)") else: - logThis("That's not a command (error code 001)",str(message.channel.id)) - await message.channel.send("That's not a command (error code 001)") + logThis(f"Something went wrong, {error}",str(ctx.message.channel.id)) + await ctx.send("Something went wrong (error code 000)") +for filename in os.listdir("./cogs"): + if filename.endswith(".py"): + client.load_extension(f"cogs.{filename[:-3]}") +# Creates the required files +makeFiles() + +# Gets secret bot token +with open("token.txt","r") as f: + token = f.read().replace("\n","") + +# Runs the whole shabang +client.run(token) diff --git a/bot.py b/bot.py deleted file mode 100644 index 4f590d8..0000000 --- a/bot.py +++ /dev/null @@ -1,52 +0,0 @@ -import discord, os - -from discord.ext import commands - -from funcs import logThis, makeFiles - -commandPrefix = "!" -client = commands.Bot(command_prefix=commandPrefix) - -# Logs in -@client.event -async def on_ready(): - logThis("Logged in as "+client.user.name+", "+str(client.user.id)) - game = discord.Game("Some weeb shit") - await client.change_presence(activity=game) - -# Loads and unloads cogs - -@client.command() -async def load(ctx,extension): - client.load_extension(f"cogs.{extension}") - -@client.command() -async def unload(ctx,extension): - client.unload_extension(f"cogs.{extension}") - -@client.event -async def on_command(ctx): - logThis(f"{ctx.message.author.display_name} ran {ctx.message.content}") - -# Logs if a command experiences an error -@client.event -async def on_command_error(ctx, error): - if isinstance(error, commands.CommandNotFound): - await ctx.send("That's not a command (error code 001)") - else: - logThis(f"Something went wrong, {error}",str(ctx.message.channel.id)) - await ctx.send("Something went wrong (error code 000)") - -for filename in os.listdir("./cogs"): - if filename.endswith(".py"): - client.load_extension(f"cogs.{filename[:-3]}") - -# Creates the required files -makeFiles() - -# Gets secret bot token -with open("token.txt","r") as f: - token = f.read().replace("\n","") - -# Runs the whole shabang -client.run(token)