33 lines
990 B
Python
33 lines
990 B
Python
from bot.cogs.cog_manager import BaseCog
|
|
import discord
|
|
import asyncio
|
|
|
|
class ExampleCog(BaseCog):
|
|
def __init__(self, bot):
|
|
super().__init__(bot)
|
|
# Initialize any state for this cog
|
|
self.counter = 0
|
|
|
|
def cleanup(self):
|
|
# Clean up any resources when unloaded
|
|
print("Example cog is being unloaded and cleaned up")
|
|
|
|
async def cmd_hello(self, message):
|
|
"""
|
|
A simple hello command
|
|
Usage: .hello
|
|
"""
|
|
self.counter += 1
|
|
await message.edit(content=f"👋 Hello! I've been greeted {self.counter} times.")
|
|
|
|
async def cmd_echo(self, message):
|
|
"""
|
|
Echo the user's message
|
|
Usage: .echo <message>
|
|
"""
|
|
content = message.content
|
|
if ' ' in content:
|
|
text = content.split(' ', 1)[1]
|
|
await message.edit(content=f"🔊 {text}")
|
|
else:
|
|
await message.edit(content="❌ Usage: `.echo <message>`") |