Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
venv
.vscode
__pycache__
.editorconfig
.editorconfig
env
10 changes: 8 additions & 2 deletions bothello.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 17 additions & 0 deletions cogs/command_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import discord
from discord.ext import commands


class Example(commands.Cog):

def __init__(self, client):
self.client = client


@commands.command()
async def example(self, ctx):
await ctx.send('This is an example command :)')


def setup(client):
client.add_cog(Example(client))
11 changes: 3 additions & 8 deletions cogs/greetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
17 changes: 17 additions & 0 deletions cogs/ready.py
Original file line number Diff line number Diff line change
@@ -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))
10 changes: 0 additions & 10 deletions info.py

This file was deleted.

1 change: 1 addition & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down