Add a refresh command.
This commit is contained in:
@@ -5,6 +5,7 @@ Cog loader. Adds all command cogs to the bot.
|
||||
from nextcord.ext import commands
|
||||
|
||||
from cogs.commands.record import RecordCog
|
||||
from cogs.commands.refresh import RefreshCog
|
||||
from cogs.commands.remove import RemoveCog
|
||||
from cogs.commands.request import RequestCog
|
||||
from cogs.commands.set import setCog
|
||||
@@ -20,6 +21,7 @@ def setup(bot: commands.Bot):
|
||||
"""
|
||||
|
||||
bot.add_cog(RecordCog(bot))
|
||||
bot.add_cog(RefreshCog())
|
||||
bot.add_cog(RemoveCog())
|
||||
bot.add_cog(RequestCog(bot))
|
||||
bot.add_cog(TestCog(bot))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Contained commands and views for refresh commands.
|
||||
"""
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from utils import update_clan_messages
|
||||
|
||||
|
||||
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
"""
|
||||
Class holds refresh commands.
|
||||
"""
|
||||
|
||||
@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 event(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Calls update_clan_messages() to update all messages.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction with the command.
|
||||
"""
|
||||
await update_clan_messages(interaction.guild)
|
||||
Reference in New Issue
Block a user