Added first steam API command
This commit is contained in:
parent
82228b17eb
commit
ca91cfddaf
7 changed files with 188 additions and 3 deletions
64
bot.py
64
bot.py
|
@ -1,10 +1,68 @@
|
|||
import discord
|
||||
import os
|
||||
import json
|
||||
from discord.ext import commands
|
||||
from util import logging
|
||||
|
||||
# Bot URL https://discordapp.com/api/oauth2/authorize?client_id=657709911337074698&permissions=314432&scope=bot
|
||||
|
||||
client = commands.Bot(command_prefix='.', case_insensitive=True)
|
||||
|
||||
@client.command()
|
||||
@commands.is_owner()
|
||||
async def load(ctx, extension):
|
||||
client.load_extension(f"cogs.{extension}")
|
||||
await ctx.message.add_reaction("👍")
|
||||
|
||||
@client.command()
|
||||
@commands.is_owner()
|
||||
async def unload(ctx, extension):
|
||||
client.unload_extension(f"cogs.{extension}")
|
||||
await ctx.message.add_reaction("👍")
|
||||
|
||||
|
||||
client = commands.Bot(command_prefix='.')
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
print(f"Logged in as {client.user.name}")
|
||||
logging.info("Starting up...\n")
|
||||
logging.info("Trying to load cogs...\n")
|
||||
total = 0
|
||||
failed = 0
|
||||
# Load all cogs on startup
|
||||
# Load "fun" cogs
|
||||
for filename in os.listdir("./cogs/fun"):
|
||||
if filename.endswith(".py"):
|
||||
total += 1
|
||||
cog = f"cogs.fun.{filename[:-3]}"
|
||||
|
||||
client.run()
|
||||
try:
|
||||
client.load_extension(cog)
|
||||
logging.info(f"Trying {cog}.....Success!")
|
||||
except:
|
||||
logging.error(f"Trying {cog}.....Failed!")
|
||||
failed += 1
|
||||
|
||||
|
||||
# Load "api" cogs
|
||||
for filename in os.listdir("./cogs/api"):
|
||||
if filename.endswith(".py"):
|
||||
total += 1
|
||||
cog = f"cogs.api.{filename[:-3]}"
|
||||
|
||||
try:
|
||||
client.load_extension(cog)
|
||||
logging.info(f"Trying {cog}.....Success!")
|
||||
except:
|
||||
logging.error(f"Trying {cog}.....Failed!")
|
||||
failed += 1
|
||||
|
||||
logging.info("Finished loading cogs.")
|
||||
logging.info(f"Total {total}, Failed {failed}\n")
|
||||
|
||||
logging. info("Deep Blue finished loading.")
|
||||
|
||||
with open("config.json", "r") as key_file:
|
||||
json = json.load(key_file)
|
||||
key = json["client_key"]
|
||||
|
||||
client.run(key)
|
Loading…
Add table
Add a link
Reference in a new issue