Update requirements.txt, bot.py, cogs/task.py

pull/1/head
Matt Compton 3 years ago
parent a751e328f8
commit c3bf12331c

@ -1,11 +1,27 @@
import discord,os # Stdlib
import os
# Pip
import discord
from discord.ext import commands from discord.ext import commands
from pretty_help import DefaultMenu, PrettyHelp
# Custom
from task import Packages from task import Packages
bot = commands.Bot(";") intents = discord.Intents.default()
bot.add_cog(Packages(bot)) intents.members = True
bot = commands.Bot(
command_prefix=commands.when_mentioned_or(";"),
description="Bang rocks together make package tracker bot",
intents=intents
)
helpmenu = DefaultMenu("◀️", "▶️", "")
bot.help_command = PrettyHelp(
no_category="Commands", navigation=helpmenu, color=discord.Colour.blurple()
)
@bot.command() @bot.command()
async def distrohop(ctx, *, count=None): async def distrohop(ctx, *, count=None):
@ -21,6 +37,19 @@ async def distrohop(ctx, *, count=None):
f.write(str(distrohops)) f.write(str(distrohops))
await ctx.send("Miku distrohops: " + str(distrohops)) await ctx.send("Miku distrohops: " + str(distrohops))
@bot.event
async def on_ready():
chan = await bot.get_channel(842491569176051712)
cogs_dir = "cogs"
for extension in [
f.replace(".py", "") for f in os.listdir(cogs_dir) if os.isfile(join(cogs_dir, f))
]:
try:
bot.load_extension(cogs_dir + "." + extension)
except (Exception) as e:
await chan.send(f"Failed to load extension {extension}.")
await chan.send("Started/restarted at: `" + getstamp() + "`")
if not os.path.exists(os.environ["HOME"] + "/.cavetoken"): if not os.path.exists(os.environ["HOME"] + "/.cavetoken"):
print("No token found") print("No token found")
exit() exit()

@ -1,2 +1,3 @@
feedparser feedparser
py-cord py-cord
discord-pretty-help

Loading…
Cancel
Save