Run ruff linter with autofixing.
This commit is contained in:
@@ -44,7 +44,6 @@ class ClanMessages(commands.Cog, name="Clan Messages"):
|
||||
Pulls from git and then calls method to update all the discord messages as described by the
|
||||
files in the git repo.
|
||||
"""
|
||||
|
||||
# Get all modified/added files
|
||||
modified_files: list[str] = [
|
||||
file for list in [commit.modified + commit.added for commit in hook_info.commits] for file in list
|
||||
|
||||
@@ -19,7 +19,6 @@ def setup(bot: commands.Bot):
|
||||
"""
|
||||
Adds all command classes to bot.
|
||||
"""
|
||||
|
||||
bot.add_cog(RecordCog(bot))
|
||||
bot.add_cog(RefreshCog(bot))
|
||||
bot.add_cog(RemoveCog())
|
||||
|
||||
@@ -47,7 +47,6 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
||||
name (str): Name of the event.
|
||||
host (nextcord.Member, optional): Alternative host to user using command.
|
||||
"""
|
||||
|
||||
# check role
|
||||
if interaction.guild.get_role(self.bot.config.params.event_host_role_id) not in interaction.user.roles:
|
||||
await interaction.response.send_message(
|
||||
@@ -110,7 +109,6 @@ class EventView(nextcord.ui.View):
|
||||
Submits the event embed to the event channel. Removes view and embed from recording message.
|
||||
Sends point information to database.
|
||||
"""
|
||||
|
||||
discord_users = self.event_participants.values.members
|
||||
if discord_users:
|
||||
discord_users_list: list[str] = [str(user.id) for user in discord_users if user.id is not self.host_id]
|
||||
|
||||
@@ -41,7 +41,6 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
presence (str): Is SlashOption. The presence to remove. Is the ID of the presence.
|
||||
"""
|
||||
|
||||
presence_id = int(presence_str)
|
||||
with Session(engine) as session:
|
||||
stmt = delete(Presences).where(Presences.Id == presence_id)
|
||||
@@ -60,7 +59,6 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
presence_str (str): String to run autocomplete on.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(Presences)
|
||||
presences_dict: "dict[str,str]" = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
||||
|
||||
@@ -45,7 +45,6 @@ class RequestCog(commands.Cog, name="Request Commands"):
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
presence (str): The presence to add.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
content = f'<@{interaction.user.id}> would like to add presence "{presence}."'
|
||||
view = PresenceChange(presence)
|
||||
@@ -70,7 +69,6 @@ class RequestCog(commands.Cog, name="Request Commands"):
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
new_username(str): The username to change to.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
content = f'<@{interaction.user.id}> would like to change their username to "{new_nickname}."'
|
||||
view = UsernameRequest(interaction.user.id, new_nickname)
|
||||
@@ -160,7 +158,6 @@ class PresenceChange(nextcord.ui.View):
|
||||
button (nextcord.ui.Button): Unused.
|
||||
interaction (nextcord.Interaction): The interaction of the user clicking the button.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(Presences(Presence=self.presence))
|
||||
session.commit()
|
||||
|
||||
@@ -45,7 +45,6 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
month (int, optional): The month a user was born. Is SlashOption.
|
||||
day (int, optional): The day a user was born. Is SlashOption.
|
||||
"""
|
||||
|
||||
# Must be deferred, apparently datetime takes a little bit on invalid dates.
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
Args:
|
||||
interaction (nextcord.Interaction): _description_
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
get_current_election_cycle(config),
|
||||
|
||||
@@ -104,7 +104,6 @@ class ViewCog(commands.Cog, name="View Commands"):
|
||||
Args:
|
||||
interaction (nextcord.Integration): User's interaction with the command.
|
||||
"""
|
||||
|
||||
# might take a while depending on number of presences
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
@@ -141,7 +140,6 @@ class ViewCog(commands.Cog, name="View Commands"):
|
||||
interaction (nextcord.Interaction): User's interaction with the command.
|
||||
election_name (str): Is SlashOption. The name of the election to view votes for.
|
||||
"""
|
||||
|
||||
stmt = select(Votes).where(Votes.ElectionCycle == election_name).where(Votes.Type == election_type)
|
||||
|
||||
with Session(engine) as session:
|
||||
@@ -170,7 +168,6 @@ class ViewCog(commands.Cog, name="View Commands"):
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
election_name (str): String to run autocomplete on.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(Votes.ElectionCycle).distinct()
|
||||
elections = session.scalars(stmt)
|
||||
@@ -194,7 +191,6 @@ class ViewCog(commands.Cog, name="View Commands"):
|
||||
interaction (nextcord.Interaction): Interaction with command.
|
||||
quarter_name (str): String to run autocomplete on.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ParticipationPoints.Cycle).distinct()
|
||||
quarters = session.scalars(stmt)
|
||||
|
||||
@@ -12,6 +12,5 @@ def setup(bot: commands.Bot):
|
||||
"""
|
||||
Adds functions to bot.
|
||||
"""
|
||||
|
||||
bot.add_cog(BotPresence(bot))
|
||||
bot.add_cog(DailyLoop(bot))
|
||||
|
||||
@@ -35,7 +35,6 @@ class BotPresence(commands.Cog, name="Bot Presence"):
|
||||
|
||||
async def change_presence(self):
|
||||
"""Randomly chooses a presence and updates bot's presence."""
|
||||
|
||||
with Session(engine) as session:
|
||||
presence = session.scalar(select(Presences.Presence).order_by(func.random()))
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
an active election, runs the check_date() function for the election to perform actions. Finally checks if the
|
||||
election is over to delete the current election object.
|
||||
"""
|
||||
|
||||
if self.current_election is None:
|
||||
self.current_election = self.get_election_cycle()
|
||||
|
||||
@@ -61,7 +60,6 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
"""
|
||||
Actions run before the loop starts. Want to wait for bot to be ready and get the current cycle.
|
||||
"""
|
||||
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
# Bot needs to know guilds to get the current cycle.
|
||||
@@ -75,7 +73,6 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
Returns:
|
||||
ElectionCycle: Current election cycle, None if there is no election happening.
|
||||
"""
|
||||
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = get_current_election_cycle(config)
|
||||
|
||||
@@ -108,7 +105,6 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
||||
Loops through the guild's humans checking for joined_at dates that match today's date. Sends a message
|
||||
saying happy cakeday.
|
||||
"""
|
||||
|
||||
today = datetime.today()
|
||||
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id)
|
||||
announce_channel: nextcord.TextChannel = guild.get_channel(self.bot.config.params.general_channel_id)
|
||||
|
||||
@@ -38,6 +38,5 @@ async def birthday_action(message: nextcord.Message) -> None:
|
||||
Args:
|
||||
message (nextcord.Message): The message to check for a birthday person.
|
||||
"""
|
||||
|
||||
if message.author.id in birthday_list or bool(set(message.raw_mentions) & set(birthday_list)):
|
||||
await message.add_reaction("🎂")
|
||||
|
||||
Reference in New Issue
Block a user