Finish up smells in the commands directory.
Add a discord max message length constant. Move boolean argument to not be positional.
This commit is contained in:
+14
-17
@@ -1,8 +1,7 @@
|
||||
"""
|
||||
Contained commands and views for refresh commands.
|
||||
"""
|
||||
"""Contained commands and views for refresh commands."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
@@ -11,22 +10,16 @@ from utils import MESSAGES_DIR, edit_clan_council_info, update_clan_messages
|
||||
|
||||
|
||||
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
"""
|
||||
Class holds refresh commands.
|
||||
"""
|
||||
"""Class holds refresh commands."""
|
||||
|
||||
def __init__(self, bot) -> None:
|
||||
"""
|
||||
Default constructor for RefreshCog class. Does nothing.
|
||||
"""
|
||||
def __init__(self, bot: commands.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.
|
||||
"""
|
||||
async def refresh(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for refresh. Never called."""
|
||||
|
||||
@refresh.subcommand(description="Force refresh all of the bot managed messages.")
|
||||
async def messages(
|
||||
@@ -36,8 +29,10 @@ class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
description="Channel to refresh messages in.",
|
||||
required=False,
|
||||
),
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Updates all messages.
|
||||
|
||||
Calls update_clan_messages() to update all messages.
|
||||
|
||||
Args:
|
||||
@@ -48,7 +43,7 @@ class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
|
||||
if channel is None:
|
||||
channel_updates = [
|
||||
dir_name for dir_name in os.listdir(MESSAGES_DIR) if os.path.isdir(f"{MESSAGES_DIR}/{dir_name}")
|
||||
dir_name for dir_name in os.listdir(MESSAGES_DIR) if Path(f"{MESSAGES_DIR}/{dir_name}").is_dir()
|
||||
]
|
||||
else:
|
||||
channel_updates = [channel.name]
|
||||
@@ -57,8 +52,10 @@ class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||
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):
|
||||
async def council_info(self, interaction: nextcord.Interaction) -> None:
|
||||
"""
|
||||
Edits the clan council info message.
|
||||
|
||||
Calls edit_clan_council_info().
|
||||
|
||||
Args:
|
||||
|
||||
Reference in New Issue
Block a user