Initial commit.

This commit is contained in:
DefsNotQuack
2025-03-29 10:58:56 +10:00
commit b17e3c5f28
6 changed files with 137 additions and 0 deletions

0
cogs/__init__.py Normal file
View File

30
cogs/channel.py Normal file
View File

@@ -0,0 +1,30 @@
import discord
from discord.ext import commands
class Channel(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="clear_channel",
description="Permanently delete all messages in a channel",
guild_ids=[681414775468589180])
@commands.has_permissions(manage_messages=True)
async def clear_channel(self, ctx: discord.ApplicationContext):
progress = await ctx.respond("Deleting all messages in this channel...", ephemeral=True)
channel = ctx.channel
# Fetch all messages in the channel
async for message in channel.history(limit=None):
try:
await message.delete()
except discord.Forbidden:
await ctx.send("I do not have permission to delete messages.")
return
except discord.HTTPException:
await ctx.send("Failed to delete a message.")
return
await progress.edit(content="✔ All messages deleted successfully! ✔")
def setup(bot):
bot.add_cog(Channel(bot))

15
cogs/hello.py Normal file
View File

@@ -0,0 +1,15 @@
import discord
from discord.ext import commands
class Hello(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="hello",
description="Say hi to the bot!",
guild_ids=[681414775468589180])
async def hello(self, ctx: discord.ApplicationContext):
await ctx.respond("Hello there!")
def setup(bot):
bot.add_cog(Hello(bot))

13
cogs/ping.py Normal file
View File

@@ -0,0 +1,13 @@
import discord
from discord.ext import commands
class Ping(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="ping", description="Ping the bot")
async def ping(self, ctx: discord.ApplicationContext):
await ctx.respond("🏓 Pong!")
def setup(bot):
bot.add_cog(Ping(bot))