Remove config param from record_event_points().

This commit is contained in:
2024-09-03 19:31:40 -04:00
parent b1f8e9d742
commit 06d81a4604
2 changed files with 4 additions and 8 deletions
+1 -5
View File
@@ -118,7 +118,6 @@ class RecordCog(commands.Cog, name="Record Commands"):
return
elif recipient is not None: # noqa: RET505
record_event_points(
self.bot.config,
[str(recipient.id)],
self.bot.config.params.event_participate_points,
is_member=True,
@@ -126,7 +125,6 @@ class RecordCog(commands.Cog, name="Record Commands"):
recipient_str = f"<@{recipient.id}>"
elif non_discord_recipient is not None:
record_event_points(
self.bot.config,
[non_discord_recipient],
self.bot.config.params.event_participate_points,
is_member=False,
@@ -189,7 +187,6 @@ class EventView(nextcord.ui.View):
if discord_users:
discord_users_list: list[str] = [str(user.id) for user in discord_users if user.id is not self.host_id]
record_event_points(
self.config,
discord_users_list,
self.config.params.event_participate_points,
is_member=True,
@@ -199,13 +196,12 @@ class EventView(nextcord.ui.View):
if non_discord_users:
non_discord_users_list: list[str] = non_discord_users.split("\n")
record_event_points(
self.config,
non_discord_users_list,
self.config.params.event_participate_points,
is_member=False,
)
record_event_points(self.config, [self.host_id], self.config.params.event_host_points, is_member=True)
record_event_points([self.host_id], self.config.params.event_host_points, is_member=True)
event_channel: nextcord.TextChannel = interaction.guild.get_channel(self.config.params.event_post_channel_id)
await event_channel.send(embed=interaction.message.embeds[0])
+3 -3
View File
@@ -289,7 +289,7 @@ def decorate_dm_nomination(user_id: int, speech: str) -> str:
return msg
def record_event_points(config: DakinySettings, users: Sequence[str], add_points: int, *, is_member: bool) -> None:
def record_event_points(users: Sequence[str], add_points: int, *, is_member: bool) -> None:
"""
Adds event points to all users listed.
@@ -309,7 +309,7 @@ def record_event_points(config: DakinySettings, users: Sequence[str], add_points
points = session.scalar(stmt)
if points is None:
add_points = get_allowed_points(session, config.params.event_points_weekly_limit, user, add_points)
add_points = get_allowed_points(session, settings.event_settings.weekly_limit, user, add_points)
new_points = EventPoints(
QuarterName=quarter_name,
UserId=user,
@@ -318,7 +318,7 @@ def record_event_points(config: DakinySettings, users: Sequence[str], add_points
)
session.add(new_points)
else:
add_points = get_allowed_points(session, config.params.event_points_weekly_limit, user, add_points)
add_points = get_allowed_points(session, settings.event_settings.weekly_limit, user, add_points)
points.Points += add_points
session.commit()