Registrations currently disabled due to spam. Contact me externally if you need an account

Skip to content
Snippets Groups Projects
Unverified Commit fc1b08c5 authored by PhenoM4n4n's avatar PhenoM4n4n
Browse files

[slashtags] add restore from db command

parent ff77ed07
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ class SlashTags(Commands, Processor, commands.Cog, metaclass=CompositeMetaClass)
The TagScript documentation can be found [here](https://phen-cogs.readthedocs.io/en/latest/index.html).
"""
__version__ = "0.5.2"
__version__ = "0.5.3"
__author__ = ("PhenoM4n4n",)
def format_help_for_context(self, ctx: commands.Context):
......
......@@ -488,6 +488,30 @@ class Commands(MixinMeta):
"""
await self.show_slash_tag_usage(ctx, ctx.guild)
@commands.is_owner()
@slashtag.command("restore", hidden=True)
async def slashtag_restore(self, ctx: commands.Context):
"""Restore all slash tags for this server from the database."""
pred = MessagePredicate.yes_or_no(ctx)
try:
await self.send_and_query_response(
ctx,
"Are you sure you want to restore all slash tags on this server from the database? (Y/n)",
pred,
)
except asyncio.TimeoutError:
return await ctx.send("Timed out, not restoring slash tags.")
if not pred.result:
return await ctx.send("Ok, not restoring slash tags.")
slashtags = self.guild_tag_cache[ctx.guild.id]
if not slashtags:
return await ctx.send("No slash tags have been created for this server.")
await ctx.send(f"Restoring {len(slashtags)} slash tags...")
async with ctx.typing():
for tag in slashtags.values():
await tag.register()
await ctx.send(f"Restored {len(slashtags)} slash tags.")
@commands.is_owner()
@slashtag.command("clear", hidden=True)
async def slashtag_clear(self, ctx: commands.Context):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment