First official build of bot!

Co-authored-by: iakrules <64628083+iakrules@noreply.github.com>
This commit is contained in:
rzmk 2021-08-01 14:24:02 -04:00
parent 953c89ead0
commit 2b8e2345f9
32 changed files with 1164 additions and 383 deletions

82
bot.py
View file

@ -1,47 +1,35 @@
# Import all required packages and variables
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.environ.get("TOKEN")
client = commands.Bot(command_prefix='d!')
# Bot initialized
@client.event
async def on_ready():
print(f'{client.user.name} is ready.')
await client.change_presence(activity=discord.Streaming(name="duck pictures.", url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"))
@commands.is_owner()
@client.command()
async def load(ctx, extension):
"""Loads a cog"""
client.load_extension(f'cogs.{extension}')
@commands.is_owner()
@client.command()
async def unload(ctx, extension):
"""Unloads a cog"""
client.unload_extension(f'cogs.{extension}')
# Cogs
for filename in os.listdir('./cogs/info'):
if filename.endswith('.py'):
client.load_extension(f'cogs.info.{filename[:-3]}')
for filename in os.listdir('./cogs/moderation'):
if filename.endswith('.py'):
client.load_extension(f'cogs.moderation.{filename[:-3]}')
for filename in os.listdir('./cogs/music'):
if filename.endswith('.py'):
client.load_extension(f'cogs.music.{filename[:-3]}')
for filename in os.listdir('./cogs/inventory'):
if filename.endswith('.py'):
client.load_extension(f'cogs.inventory.{filename[:-3]}')
client.run(TOKEN)
# Import all required packages and variables
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents().all()
TOKEN = os.environ.get("TOKEN")
bot = commands.Bot(command_prefix='.', intents=intents)
# Bot initialized
@bot.event
async def on_ready():
print(f'{bot.user.name} is ready.')
await bot.change_presence(activity=discord.Streaming(name="Use .help to learn more!", url="https://linktr.ee/RutgersEsports"))
class CustomHelpCommand(commands.MinimalHelpCommand):
async def send_pages(self):
destination = self.get_destination()
for page in self.paginator.pages:
embed = discord.Embed(description=page, color=0xC94949)
await destination.send(embed=embed)
bot.help_command = CustomHelpCommand()
# Cogs
for group in os.listdir('./cogs'):
for cog in os.listdir(f'./cogs/{group}'):
if cog.endswith('.py'):
bot.load_extension(f'cogs.{group}.{cog[:-3]}')
bot.run(TOKEN)