forked from sass/tipibot
29 lines
927 B
Python
29 lines
927 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
import discord
|
|
from discord import app_commands
|
|
|
|
from core import lan_fienta
|
|
import strings as S
|
|
|
|
|
|
def register_lan_fienta_commands(
|
|
tree: app_commands.CommandTree,
|
|
bot: discord.Client,
|
|
log: logging.Logger,
|
|
) -> None:
|
|
@tree.command(name="fientasync", description=S.CMD["fientasync"])
|
|
@app_commands.guild_only()
|
|
@app_commands.default_permissions(manage_guild=True)
|
|
async def cmd_fientasync(interaction: discord.Interaction):
|
|
await interaction.response.defer(ephemeral=True)
|
|
try:
|
|
summary = await lan_fienta.resync_all(bot)
|
|
except Exception as exc:
|
|
log.exception("/fientasync failed")
|
|
await interaction.followup.send(f"❌ Fienta sync failed: `{exc}`", ephemeral=True)
|
|
return
|
|
await interaction.followup.send(f"✅ Fienta sync done: `{summary.short()}`", ephemeral=True)
|