From 91cb11d20ea6c36bc6c675b0c1f032c6ff3e0229 Mon Sep 17 00:00:00 2001 From: ishaan Date: Tue, 18 May 2021 18:17:31 -0400 Subject: [PATCH] initial bot setup --- Procfile | 0 README.md | 5 ++++- bot.py | 20 ++++++++++++++++++++ cogs/exampleCog.py | 20 ++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Procfile create mode 100644 bot.py create mode 100644 cogs/exampleCog.py create mode 100644 requirements.txt diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 2467c7e..7acc8df 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ -# duckster +# Duckster +A fun and all-purpose bot made in Python. + +Founded by @iakrules and @rzmk \ No newline at end of file diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..05d301a --- /dev/null +++ b/bot.py @@ -0,0 +1,20 @@ +import os +import discord +from discord.ext import commands + +TOKEN = os.environ.get("TOKEN") +client = commands.Bot(command_prefix= 'd!') + +@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}') + +for filename in os.listdir('./cogs'): + if filename.endswith('.py'): + client.load_extension(f'cogs.{filename[:-3]}') + +client.run(TOKEN) \ No newline at end of file diff --git a/cogs/exampleCog.py b/cogs/exampleCog.py new file mode 100644 index 0000000..19b2af8 --- /dev/null +++ b/cogs/exampleCog.py @@ -0,0 +1,20 @@ +import discord +from discord.ext import commands + +class ExampleCog(commands.Cog): + + def __init__(self, client): + self.client = client + + # Events + @commands.Cog.listener() + async def on_ready(self): + print('Bot is online.') + + # Commands + @commands.command() + async def ping(self, ctx): + await ctx.send('Pong!') + +def setup(client): + client.add_cog(ExampleCog(client)) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e80511c --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +discord.py==1.7.2 \ No newline at end of file