Created
May 27, 2019 06:43
-
-
Save Vexs/367e7140a7a09c1160357f9007506198 to your computer and use it in GitHub Desktop.
Short cog example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from discord.ext import commands | |
#cogs must now subclass commands.Cog | |
class MyCog(commands.Cog): | |
def __init__(self, bot): | |
self.bot = bot | |
#listeners now must have a decorator | |
@commands.Cog.listener() | |
async def on_message(self, message): | |
print(message.content) | |
@commands.command() | |
async def echo(self, ctx, *, message): | |
await ctx.send(message) | |
#this is technically part of extensions | |
def setup(bot): | |
bot.add_cog(MyCog(bot)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment