Initial commit.
This commit is contained in:
0
cogs/__init__.py
Normal file
0
cogs/__init__.py
Normal file
30
cogs/channel.py
Normal file
30
cogs/channel.py
Normal 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
15
cogs/hello.py
Normal 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
13
cogs/ping.py
Normal 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))
|
||||
Reference in New Issue
Block a user