Update message decorator for each type of highcouncil elect.
This commit is contained in:
@@ -9,7 +9,12 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import CouncilMembers, engine
|
||||
from utils import NOMINEE_SPLITTER, decorate_nomination, get_election_cycle_name
|
||||
from utils import (
|
||||
NOMINEE_SPLITTER,
|
||||
decorate_cl_nomination,
|
||||
decorate_dm_nomination,
|
||||
get_election_cycle_name,
|
||||
)
|
||||
|
||||
|
||||
class NominateDMModal(nextcord.ui.Modal):
|
||||
@@ -51,7 +56,7 @@ class NominateDMModal(nextcord.ui.Modal):
|
||||
|
||||
"""
|
||||
|
||||
speech = decorate_nomination(interaction.user.id, self.speech.value)
|
||||
speech = decorate_dm_nomination(interaction.user.id, self.speech.value)
|
||||
|
||||
with Session(engine) as session:
|
||||
# user already in table
|
||||
@@ -73,7 +78,9 @@ class NominateDMModal(nextcord.ui.Modal):
|
||||
council_elect.DiscordManagerSpeechId
|
||||
)
|
||||
await msg.edit(
|
||||
content=decorate_nomination(interaction.user.id, self.speech.value)
|
||||
content=decorate_dm_nomination(
|
||||
interaction.user.id, self.speech.value
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -116,7 +123,7 @@ class NominateCLModal(nextcord.ui.Modal):
|
||||
|
||||
"""
|
||||
|
||||
speech = decorate_nomination(interaction.user.id, self.speech.value)
|
||||
speech = decorate_cl_nomination(interaction.user.id, self.speech.value)
|
||||
|
||||
with Session(engine) as session:
|
||||
# user already in table
|
||||
@@ -138,7 +145,9 @@ class NominateCLModal(nextcord.ui.Modal):
|
||||
council_elect.ClanLeaderSpeechId
|
||||
)
|
||||
await msg.edit(
|
||||
content=decorate_nomination(interaction.user.id, self.speech.value)
|
||||
content=decorate_cl_nomination(
|
||||
interaction.user.id, self.speech.value
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -224,3 +224,39 @@ def decorate_nomination(user_id: int, speech: str) -> str:
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_cl_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Clan Leader Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def decorate_dm_nomination(user_id: int, speech: str) -> str:
|
||||
"""
|
||||
Decorates a nomination speech so that it sits within multiple speeches better.
|
||||
|
||||
Args:
|
||||
user_id (int): ID of user sending the speech
|
||||
speech (str): Speech from the user
|
||||
|
||||
Returns:
|
||||
str: Decorated speech
|
||||
"""
|
||||
msg = f"**Discord Manager Nominee: <@{user_id}>**\n"
|
||||
msg += NOMINEE_SPLITTER
|
||||
msg += speech
|
||||
|
||||
return msg
|
||||
|
||||
Reference in New Issue
Block a user