diff --git a/.gitignore b/.gitignore index bf96b13..bb1e904 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ venv .vscode __pycache__ -.editorconfig \ No newline at end of file +.editorconfig +env \ No newline at end of file diff --git a/bothello.py b/bothello.py index 6fc13cb..eed0853 100644 --- a/bothello.py +++ b/bothello.py @@ -10,27 +10,33 @@ client = commands.Bot(command_prefix='!') - +# Load Cog Command @client.command() async def load(ctx, extension): + print(f'[LOADING EXT] - {extension}') client.load_extension(f'cogs.{extension}') +# Unload Cog command @client.command() async def unload(ctx, extension): + print(f'[UNLOADING EXT] - {extension}') client.unload_extension(f'cogs.{extension}') +# Reload Cog Command @client.command() async def reload(ctx, extension): + print(f'[RELOADING EXT] - {extension}') client.unload_extension(f'cogs.{extension}') client.load_extension(f'cogs.{extension}') +# Initialize Cogs for filename in listdir('./cogs'): if filename.endswith('.py'): + print(f'[LOADING EXT] - {filename[:-3]}') client.load_extension(f'cogs.{filename[:-3]}') - print(f'cogs.{filename[:-3]}') client.run(token_bot) diff --git a/cogs/greetings.py b/cogs/greetings.py index 869b08a..081c242 100644 --- a/cogs/greetings.py +++ b/cogs/greetings.py @@ -7,15 +7,10 @@ class Greetings(commands.Cog): def __init__(self, client): self.client = client - @commands.Cog.listener() - async def on_ready(client): - print(f'We are online {client}') - # await utils.set_presence(client) - - @commands.command() - async def hello(self, ctx): - await ctx.send("Para de pingar mardito") + @commands.Cog.listener() + async def on_member_join(self, member): + print(f'[MEMBER JOINED] - {member}') def setup(client): client.add_cog(Greetings(client)) diff --git a/cogs/ready.py b/cogs/ready.py new file mode 100644 index 0000000..f3b9450 --- /dev/null +++ b/cogs/ready.py @@ -0,0 +1,17 @@ +import utils +import discord +from discord.ext import commands + + +class Ready(commands.Cog): + + def __init__(self, client): + self.client = client + + @commands.Cog.listener() + async def on_ready(client): + print('[BOT READY!]') + + +def setup(client): + client.add_cog(Ready(client)) diff --git a/info.py b/info.py deleted file mode 100644 index 7dad644..0000000 --- a/info.py +++ /dev/null @@ -1,10 +0,0 @@ -from discord.ext import commands - - -class Info(commands.Cog): - def __init__(self, bot): - self.bot = bot - - @commands.command() - async def info(self, ctx): - print(self.bot.application_info()) diff --git a/utils.py b/utils.py index e742da7..1b60815 100644 --- a/utils.py +++ b/utils.py @@ -1,5 +1,6 @@ import discord +# Set Bot Presence async def set_presence(client, game="Python"): game = discord.Game(game) await client.change_presence(status=discord.Status.idle, activity=game)