🐛
This commit is contained in:
84
Gwendolyn.py
84
Gwendolyn.py
@@ -1,54 +1,52 @@
|
|||||||
# -*- coding: utf-8 -*-
|
import discord, os
|
||||||
|
|
||||||
import discord
|
|
||||||
import asyncio
|
|
||||||
#import pickle
|
|
||||||
import codecs
|
|
||||||
import string
|
|
||||||
import json
|
|
||||||
import random
|
|
||||||
#import math
|
|
||||||
import os
|
|
||||||
|
|
||||||
from discord.ext import commands
|
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
|
# Logs in
|
||||||
blackjackMinCards = 50
|
@client.event
|
||||||
blackjackDecks = 4
|
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
|
@client.command()
|
||||||
elif content.startswith("fourinarow"):
|
async def load(ctx,extension):
|
||||||
try:
|
client.load_extension(f"cogs.{extension}")
|
||||||
command = content.replace("fourinarow","")
|
|
||||||
await fiar(message.channel,command,"#"+str(message.author.id))
|
|
||||||
except:
|
|
||||||
logThis("Something went wrong (error code 1400)")
|
|
||||||
|
|
||||||
# Runs a game of Hex
|
@client.command()
|
||||||
elif content.startswith("hex"):
|
async def unload(ctx,extension):
|
||||||
try:
|
client.unload_extension(f"cogs.{extension}")
|
||||||
command = content.replace("hex","")
|
|
||||||
await runHex(message.channel,command,"#"+str(message.author.id))
|
@client.event
|
||||||
except:
|
async def on_command(ctx):
|
||||||
logThis("Something went wrong (error code 1500)")
|
logThis(f"{ctx.message.author.display_name} ran {ctx.message.content}")
|
||||||
|
|
||||||
# Runs a game of monopoly
|
# Logs if a command experiences an error
|
||||||
elif content.startswith("monopoly"):
|
@client.event
|
||||||
try:
|
async def on_command_error(ctx, error):
|
||||||
command = content.replace("monopoly","",1)
|
if isinstance(error, commands.CommandNotFound):
|
||||||
await runMonopoly(message.channel,command,"#"+str(message.author.id))
|
await ctx.send("That's not a command (error code 001)")
|
||||||
except:
|
|
||||||
logThis("Something went wrong (error code 1600)")
|
|
||||||
|
|
||||||
# Not a command
|
|
||||||
else:
|
else:
|
||||||
logThis("That's not a command (error code 001)",str(message.channel.id))
|
logThis(f"Something went wrong, {error}",str(ctx.message.channel.id))
|
||||||
await message.channel.send("That's not a command (error code 001)")
|
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)
|
||||||
|
|||||||
52
bot.py
52
bot.py
@@ -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)
|
|
||||||
Reference in New Issue
Block a user