-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
executable file
·65 lines (55 loc) · 1.72 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3.8
from discord.ext import commands, tasks
import discord
import asyncio
from dotenv import load_dotenv
from os import getenv as envv, listdir
from webhook import comp_announcements
load_dotenv()
TOKEN = envv('DISCORD_TOKEN')
bot = commands.Bot(command_prefix='?')
# bot.remove_command("help")
@bot.event
async def on_ready():
comp_announcements.start()
print("Ready!")
"""
@bot.command()
async def s(ctx, event: str = "333", num: str = "1"):
event = event.lower()
isevent = False
for item in events:
if event in events[item]:
event = item
isevent = True
if int(num) > 5:
await ctx.send("You cannot generate more than 5 scrambles at a time")
elif isevent:
if event[-2:] == "bf":
event = event[:-2] + "bld"
response = requests.get(envv("SCRAMBLE_API") + event + envv("SCRAMBLE_NUM") + num)
data = response.json()
strsend = "```"
for i in data["scrambles"]:
strsend += str(i) + "\n\n"
strsend += "```"
await ctx.send(strsend)
else:
await ctx.send("Could not match " + event + " to an event.")"""
@bot.command()
async def load(ctx, extension):
bot.load_extension(f"cogs.{extension}")
@bot.command()
async def unload(ctx, extension):
bot.unload_extension(f"cogs.{extension}")
@bot.command()
async def reload(ctx, extension):
bot.unload_extension(f"cogs.{extension}")
await asyncio.sleep(1)
bot.load_extension(f"cogs.{extension}")
await ctx.send(f"{extension} cog reloaded")
for filename in listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
# bot.loop.create_task(comp_announcements())
bot.run(TOKEN)