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
37 changes: 0 additions & 37 deletions cogs/cOREmands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from discord.ext import commands

from util import app_is_staff, is_staff, create_deletion_embed, reply
from timeutil import UserFriendlyTime


class COREmands(commands.Cog):
Expand Down Expand Up @@ -41,41 +40,5 @@ async def trust(self, ctx, member: discord.Member):
await member.add_roles(role)
await reply(ctx, f"{member.display_name} is now Trusted.")

class DeleteModal(discord.ui.Modal, title="Reason for deleting"):
reason = discord.ui.TextInput(
label="Reason",
placeholder="Why are you deleting this message?",
style=discord.TextStyle.long,
required=True,
)

def __init__(self, message: discord.Message, bot):
super().__init__()
self.original_message = message
self.bot = bot

async def on_submit(self, interaction: discord.Interaction):
reason = str(self.reason).strip()
if reason == "":
reason = "No reason provided"
await interaction.response.send_message(
f'Message deleted by {interaction.user.mention}: "{reason}"'
)
channel = interaction.guild.get_channel(self.bot.config["channels"]["audit_log"])
embed, attachments = await create_deletion_embed(
interaction.user,
reason,
self.original_message,
)
await channel.send(embed=embed, files=attachments)
await self.original_message.delete()

@app_is_staff()
async def delete_message(
self, interaction: discord.Interaction, message: discord.Message
):
await interaction.response.send_modal(self.DeleteModal(message, self.bot))


async def setup(bot):
await bot.add_cog(COREmands(bot))
8 changes: 8 additions & 0 deletions cogs/randcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,13 @@ async def oreify(self, ctx, *, text: str):
result = re.sub(pattern, lambda m: m.group() if m.group().lower() == 'ore' else 'ORE', text, flags=re.IGNORECASE)
await reply(ctx, result)

@commands.command(help="Countdown from 5 seconds in chat")
@commands.cooldown(2, 60, commands.BucketType.channel)
async def countdown(self, ctx):
for i in range(5, 0, -1):
await reply(ctx, f"Starting in {i}...")
await asyncio.sleep(1)
await reply(ctx, "Go!")

async def setup(bot):
await bot.add_cog(RandCommands(bot))