Remove placeholders and make title truncated instead of the embed field
This commit is contained in:
@ -45,7 +45,6 @@ def create_pages(ctx) -> list[Page]:
|
|||||||
trigger_text = trigger_value
|
trigger_text = trigger_value
|
||||||
|
|
||||||
message = job.kwargs.get("message")
|
message = job.kwargs.get("message")
|
||||||
message = (message[:95] + '..') if len(message) > 95 else message
|
|
||||||
|
|
||||||
edit_button = interactions.Button(
|
edit_button = interactions.Button(
|
||||||
label="Edit",
|
label="Edit",
|
||||||
@ -108,10 +107,11 @@ def create_pages(ctx) -> list[Page]:
|
|||||||
components.insert(1, pause_or_unpause_button)
|
components.insert(1, pause_or_unpause_button)
|
||||||
|
|
||||||
# Add a page to pages list
|
# Add a page to pages list
|
||||||
|
title = (message[:95] + '..') if len(message) > 95 else message
|
||||||
pages.append(
|
pages.append(
|
||||||
Page(
|
Page(
|
||||||
embeds=embed,
|
embeds=embed,
|
||||||
title=message,
|
title=title,
|
||||||
components=ActionRow(components=components), # type: ignore
|
components=ActionRow(components=components), # type: ignore
|
||||||
callback=callback,
|
callback=callback,
|
||||||
position=RowPosition.BOTTOM,
|
position=RowPosition.BOTTOM,
|
||||||
@ -135,7 +135,6 @@ async def callback(self: Paginator, ctx: ComponentContext):
|
|||||||
components = [
|
components = [
|
||||||
interactions.TextInput( # type: ignore
|
interactions.TextInput( # type: ignore
|
||||||
style=interactions.TextStyleType.PARAGRAPH,
|
style=interactions.TextStyleType.PARAGRAPH,
|
||||||
placeholder=old_message,
|
|
||||||
label="New message",
|
label="New message",
|
||||||
custom_id="new_message",
|
custom_id="new_message",
|
||||||
value=old_message,
|
value=old_message,
|
||||||
@ -150,7 +149,6 @@ async def callback(self: Paginator, ctx: ComponentContext):
|
|||||||
components.append(
|
components.append(
|
||||||
interactions.TextInput( # type: ignore
|
interactions.TextInput( # type: ignore
|
||||||
style=interactions.TextStyleType.SHORT,
|
style=interactions.TextStyleType.SHORT,
|
||||||
placeholder=str(trigger_time),
|
|
||||||
label="New date, Can be human readable or ISO8601",
|
label="New date, Can be human readable or ISO8601",
|
||||||
custom_id="new_date",
|
custom_id="new_date",
|
||||||
value=str(trigger_time),
|
value=str(trigger_time),
|
||||||
|
@ -6,7 +6,7 @@ import interactions
|
|||||||
from apscheduler.jobstores.base import JobLookupError
|
from apscheduler.jobstores.base import JobLookupError
|
||||||
from apscheduler.triggers.date import DateTrigger
|
from apscheduler.triggers.date import DateTrigger
|
||||||
from dateparser.conf import SettingValidationError
|
from dateparser.conf import SettingValidationError
|
||||||
from interactions import CommandContext, Embed, Option, OptionType
|
from interactions import CommandContext, Embed, Option, OptionType, autodefer
|
||||||
from interactions.ext.paginator import Paginator
|
from interactions.ext.paginator import Paginator
|
||||||
|
|
||||||
from discord_reminder_bot.countdown import calculate
|
from discord_reminder_bot.countdown import calculate
|
||||||
@ -31,6 +31,7 @@ async def base_command(ctx: interactions.CommandContext):
|
|||||||
|
|
||||||
|
|
||||||
@bot.modal("edit_modal")
|
@bot.modal("edit_modal")
|
||||||
|
@autodefer()
|
||||||
async def modal_response_edit(ctx: CommandContext, *response: str):
|
async def modal_response_edit(ctx: CommandContext, *response: str):
|
||||||
"""Edit a reminder.
|
"""Edit a reminder.
|
||||||
|
|
||||||
@ -189,6 +190,7 @@ async def list_command(ctx: interactions.CommandContext):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@autodefer()
|
||||||
async def command_add(
|
async def command_add(
|
||||||
ctx: interactions.CommandContext,
|
ctx: interactions.CommandContext,
|
||||||
message_reason: str,
|
message_reason: str,
|
||||||
@ -342,6 +344,7 @@ async def command_add(
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@autodefer()
|
||||||
async def remind_cron(
|
async def remind_cron(
|
||||||
ctx: interactions.CommandContext,
|
ctx: interactions.CommandContext,
|
||||||
message_reason: str,
|
message_reason: str,
|
||||||
@ -494,6 +497,7 @@ async def remind_cron(
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@autodefer()
|
||||||
async def remind_interval(
|
async def remind_interval(
|
||||||
ctx: interactions.CommandContext,
|
ctx: interactions.CommandContext,
|
||||||
message_reason: str,
|
message_reason: str,
|
||||||
|
Reference in New Issue
Block a user