Revamped utils to handle clan and event points in one. Updated record as needed.
This commit is contained in:
+12
-8
@@ -5,7 +5,7 @@ from discord import TextInputStyle
|
||||
from nextcord.ext import commands
|
||||
|
||||
from DakinySettings import settings
|
||||
from utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, record_event_points
|
||||
from utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, record_points
|
||||
|
||||
|
||||
class RecordCog(commands.Cog, name="Record Commands"):
|
||||
@@ -117,16 +117,18 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
||||
await interaction.response.send_message("Please only provide 1 recipient.", ephemeral=True)
|
||||
return
|
||||
elif recipient is not None: # noqa: RET505
|
||||
record_event_points(
|
||||
record_points(
|
||||
[str(recipient.id)],
|
||||
settings.point_settings.participate_points,
|
||||
settings.point_settings.clan_points,
|
||||
PointType.CLAN,
|
||||
is_member=True,
|
||||
)
|
||||
recipient_str = f"<@{recipient.id}>"
|
||||
elif non_discord_recipient is not None:
|
||||
record_event_points(
|
||||
record_points(
|
||||
[non_discord_recipient],
|
||||
settings.point_settings.participate_points,
|
||||
settings.point_settings.clan_points,
|
||||
PointType.CLAN,
|
||||
is_member=False,
|
||||
)
|
||||
recipient_str = f'"{non_discord_recipient}"'
|
||||
@@ -337,18 +339,20 @@ def process_event(discord_users: list[nextcord.Member], non_discord_users: str,
|
||||
"""
|
||||
if discord_users:
|
||||
discord_users_list: list[str] = [str(user.id) for user in discord_users if user.id is not host_id]
|
||||
record_event_points(
|
||||
record_points(
|
||||
discord_users_list,
|
||||
settings.point_settings.participate_points,
|
||||
PointType.EVENT,
|
||||
is_member=True,
|
||||
)
|
||||
|
||||
if non_discord_users:
|
||||
non_discord_users_list: list[str] = non_discord_users.split("\n")
|
||||
record_event_points(
|
||||
record_points(
|
||||
non_discord_users_list,
|
||||
settings.point_settings.participate_points,
|
||||
PointType.EVENT,
|
||||
is_member=False,
|
||||
)
|
||||
|
||||
record_event_points([host_id], settings.point_settings.host_points, is_member=True)
|
||||
record_points([host_id], settings.point_settings.host_points, PointType.EVENT, is_member=True)
|
||||
|
||||
Reference in New Issue
Block a user