mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
✨ feat(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics
✨ feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port 🐛 fix(main.py): remove duplicate cog addition in main.py ✨ feat(main.py): add cogs.Help(bot) to the list of cogs in main.py 🐛 fix(main.py): remove redundant import statements in main.py ✨ feat(main.py): add on_guild_remove event handler in main.py ✨ feat(main.py): add on_guild_join event handler in main.py ✨ feat(main.py): add support for discord.Intents in main.py ✨ feat(main.py): add intents.message_content = True in main.py ✨ feat(main.py): add intents.default() in main.py ✨ feat(main.py): add discord.Bot(intents=intents, help_command=None) in main.py ✨ feat(main.py): add import statements in main.py ✨ feat(main.py): add from src.config import debug, discord_token in main.py ✨ feat(main.py): add import discord in main.py ✨ feat(main.py): add import src.config in main.py ✨ feat(main.py): add import src.cogs in main.py ✨ feat(main.py): add import src.cogs.chat in main.py ✨ feat(main.py): add import src.cogs.manage_chat in main.py ✨ feat(main.py): add import src.cogs.moderation in main.py ✨ feat(main.py): add import src.cogs.channelSetup in main.py ✨ feat(main.py): add import src.cogs.help in main.py ✨ feat(main.py): add import src.cogs.Chat in main.py ✨ feat(main.py): add import src.cogs.ManageChat in main.py ✨ feat(main.py): add import src.cogs.Moderation in main.py ✨ feat(main.py): add import src.cogs.ChannelSetup in main.py ✨ feat(main.py): add import src.cogs.Help in main.py ✨ feat(main.py): add import src.cogs.chat in main.py ✨ feat(main.py): add import src.cogs.manage_chat in main.py ✨ feat(main.py): add import src.cogs.moderation in main.py ✨ feat(main.py): add
This commit is contained in:
@@ -9,34 +9,10 @@ class ManageChat(discord.Cog):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
@discord.slash_command(
|
||||
name="cancel", description="Cancel the last message sent into a channel"
|
||||
)
|
||||
async def cancel(self, ctx: discord.ApplicationContext):
|
||||
debug(
|
||||
f"The user {ctx.author} ran the cancel command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}"
|
||||
)
|
||||
# check if the guild is in the database
|
||||
curs_data.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
|
||||
if curs_data.fetchone() is None:
|
||||
await ctx.respond(
|
||||
"This server is not setup, please run /setup", ephemeral=True
|
||||
)
|
||||
return
|
||||
# get the last message sent by the bot in the cha where the command was sent
|
||||
last_message = await ctx.channel.fetch_message(ctx.channel.last_message_id)
|
||||
# delete the message
|
||||
await last_message.delete()
|
||||
await ctx.respond("The last message has been deleted", ephemeral=True)
|
||||
|
||||
# add a slash command called "clear" that deletes all the messages in the channel
|
||||
@discord.slash_command(
|
||||
name="clear", description="Clear all the messages in the channel"
|
||||
)
|
||||
async def clear(self, ctx: discord.ApplicationContext):
|
||||
debug(
|
||||
f"The user {ctx.author.name} ran the clear command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}"
|
||||
)
|
||||
await ctx.respond("messages deleted!", ephemeral=True)
|
||||
return await ctx.channel.purge()
|
||||
|
||||
@@ -52,9 +28,6 @@ class ManageChat(discord.Cog):
|
||||
async def transcript(
|
||||
self, ctx: discord.ApplicationContext, channel_send: discord.TextChannel = None
|
||||
):
|
||||
debug(
|
||||
f"The user {ctx.author.name} ran the transcript command command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}"
|
||||
)
|
||||
# save all the messages in the channel in a txt file and send it
|
||||
messages = await ctx.channel.history(limit=None).flatten()
|
||||
messages.reverse()
|
||||
|
||||
Reference in New Issue
Block a user