55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
"""
|
|
Contained commands and views for refresh commands.
|
|
"""
|
|
|
|
import nextcord
|
|
from nextcord.ext import commands
|
|
|
|
from utils import edit_clan_council_info, update_clan_messages
|
|
|
|
|
|
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
|
"""
|
|
Class holds refresh commands.
|
|
"""
|
|
|
|
def __init__(self, bot) -> None:
|
|
"""
|
|
Default constructor for RefreshCog class. Does nothing.
|
|
"""
|
|
super().__init__()
|
|
self.bot: commands.Bot = bot
|
|
|
|
@nextcord.slash_command(
|
|
default_member_permissions=nextcord.Permissions(administrator=True)
|
|
)
|
|
async def refresh(self, interaction: nextcord.Interaction):
|
|
"""
|
|
Parent slash command for refresh. Never called.
|
|
"""
|
|
|
|
@refresh.subcommand(description="Force refresh all of the bot managed messages.")
|
|
async def messages(self, interaction: nextcord.Interaction):
|
|
"""
|
|
Calls update_clan_messages() to update all messages.
|
|
|
|
Args:
|
|
interaction (nextcord.Interaction): Interaction with the command.
|
|
"""
|
|
await interaction.response.defer(ephemeral=True)
|
|
await update_clan_messages(interaction.guild)
|
|
await interaction.followup.send("Messages have been refreshed.", ephemeral=True)
|
|
|
|
@refresh.subcommand(description="Updates the current council info message.")
|
|
async def council_info(self, interaction: nextcord.Interaction):
|
|
"""
|
|
Calls edit_clan_council_info().
|
|
|
|
Args:
|
|
interaction (nextcord.Interaction): Interaction with the command.
|
|
"""
|
|
await edit_clan_council_info(interaction.guild, self.bot.config)
|
|
await interaction.response.send_message(
|
|
"Clan Council Info message updated.", ephemeral=True
|
|
)
|