Skip to content

Commit 01cc428

Browse files
Added a clearsnipe command
1 parent a750761 commit 01cc428

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/cogs/utility/snipe.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"footer": "Deleted message {cur} of {total}",
2121
"sticker": "🎟️ Sticker: {name}",
2222
"embed_msg": "*(had an embed)*",
23+
"cleared": "🧹 Cleared the snipe history for this channel.",
24+
"already_empty": "There's nothing to clear — no recently deleted messages in this channel.",
2325
},
2426
"de": {
2527
"empty": "Keine kürzlich gelöschten Nachrichten in diesem Kanal.",
@@ -29,6 +31,8 @@
2931
"footer": "Gelöschte Nachricht {cur} von {total}",
3032
"sticker": "🎟️ Aufkleber: {name}",
3133
"embed_msg": "*(hatte einen Embed)*",
34+
"cleared": "🧹 Snipe-Verlauf für diesen Kanal wurde gelöscht.",
35+
"already_empty": "Es gibt nichts zu löschen — keine kürzlich gelöschten Nachrichten in diesem Kanal.",
3236
},
3337
"es": {
3438
"empty": "No hay mensajes eliminados recientemente en este canal.",
@@ -38,6 +42,8 @@
3842
"footer": "Mensaje eliminado {cur} de {total}",
3943
"sticker": "🎟️ Pegatina: {name}",
4044
"embed_msg": "*(tenía un embed)*",
45+
"cleared": "🧹 Se borró el historial de mensajes cazados de este canal.",
46+
"already_empty": "No hay nada que borrar — no hay mensajes eliminados recientemente en este canal.",
4147
},
4248
},
4349
"cafe": {
@@ -49,6 +55,8 @@
4955
"footer": "deleted message {cur} of {total} · gone but not forgotten ☕",
5056
"sticker": "🎟️ sticker: {name}",
5157
"embed_msg": "*(had an embed — the mystery deepens ☕)*",
58+
"cleared": "🧹☕ swept the crumbs away — snipe history cleared for this channel.",
59+
"already_empty": "nothing to sweep up — this channel's already spotless ☕✨",
5260
},
5361
"de": {
5462
"empty": "hier wurde kürzlich nichts gelöscht — das café ist sauber ☕✨",
@@ -58,6 +66,8 @@
5866
"footer": "gelöschte nachricht {cur} von {total} · weg, aber nicht vergessen ☕",
5967
"sticker": "🎟️ aufkleber: {name}",
6068
"embed_msg": "*(hatte einen embed — das rätsel vertieft sich ☕)*",
69+
"cleared": "🧹☕ krümel weggefegt — snipe-verlauf für diesen kanal gelöscht.",
70+
"already_empty": "nichts zu fegen — dieser kanal ist schon blitzsauber ☕✨",
6171
},
6272
"es": {
6373
"empty": "no se ha borrado nada por aquí últimamente — el café está limpio ☕✨",
@@ -67,6 +77,8 @@
6777
"footer": "mensaje eliminado {cur} de {total} · ido pero no olvidado ☕",
6878
"sticker": "🎟️ pegatina: {name}",
6979
"embed_msg": "*(tenía un embed — el misterio se profundiza ☕)*",
80+
"cleared": "🧹☕ se barrieron las migas — historial de mensajes cazados borrado en este canal.",
81+
"already_empty": "nada que barrer — este canal ya está reluciente ☕✨",
7082
},
7183
},
7284
}
@@ -279,6 +291,24 @@ async def snipe(self, ctx: commands.Context):
279291
view = SnipeView(entries=history, ctx=ctx)
280292
await ctx.send(view=view, allowed_mentions=discord.AllowedMentions.none())
281293

294+
@commands.command(
295+
name="clearsnipe",
296+
aliases=["cs"],
297+
help="{ 'en': 'clear the deleted-message history for this channel ☕🧹', 'de': 'lösche den snipe-verlauf für diesen kanal' }"
298+
)
299+
@commands.guild_only()
300+
@commands.has_permissions(manage_messages=True)
301+
async def clearsnipe(self, ctx: commands.Context):
302+
"""Clear the stored deleted-message history for the current channel."""
303+
had_history = bool(self._history.pop(ctx.channel.id, None))
304+
key = "cleared" if had_history else "already_empty"
305+
306+
view = discord.ui.LayoutView()
307+
view.add_item(discord.ui.Container(
308+
discord.ui.TextDisplay(content=msg_raw(ctx, key))
309+
))
310+
await ctx.send(view=view)
311+
282312

283313
async def setup(bot):
284314
await bot.add_cog(Snipe(bot))

0 commit comments

Comments
 (0)