Skip to content

Fiddle: truncate discord notifications to fit api#127

Merged
krishan711 merged 2 commits into
mainfrom
disc
Nov 1, 2025
Merged

Fiddle: truncate discord notifications to fit api#127
krishan711 merged 2 commits into
mainfrom
disc

Conversation

@krishan711
Copy link
Copy Markdown
Contributor

Description

Screenshots:

Checklist:

  • I have updated the CHANGELOG with a summary of my changes

Copilot AI review requested due to automatic review settings November 1, 2025 08:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two independent enhancements: support for AWS session tokens in SQS queues and message truncation for Discord notifications.

  • Added optional sessionToken parameter to SqsMessageQueue for AWS session-based authentication
  • Implemented truncation logic in DiscordClient to limit messages to 1000 characters
  • Updated changelog to document the Discord notification change

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
core/queues/sqs.py Added optional sessionToken parameter and passed it to SQS client creation
core/notifications/discord_client.py Added message truncation to 1000 characters with logging
CHANGELOG.md Added entry for Discord message truncation feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +15
if len(messageText) > 1000: # noqa: PLR2004
logging.info('Truncating Discord message to 1000 characters')
messageText = messageText[:997] + '...'
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discord webhooks actually support a content limit of 2000 characters, not 1000. The current implementation unnecessarily truncates messages at half the actual API limit. Consider updating the limit to 2000 characters and adjusting the truncation to messageText[:1997] + '...'.

Suggested change
if len(messageText) > 1000: # noqa: PLR2004
logging.info('Truncating Discord message to 1000 characters')
messageText = messageText[:997] + '...'
if len(messageText) > 2000: # noqa: PLR2004
logging.info('Truncating Discord message to 2000 characters')
messageText = messageText[:1997] + '...'

Copilot uses AI. Check for mistakes.
@krishan711 krishan711 merged commit 6b449e1 into main Nov 1, 2025
10 checks passed
@krishan711 krishan711 deleted the disc branch November 1, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants