-
Notifications
You must be signed in to change notification settings - Fork 37
Release: Discord fixes and dependency updates #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -257,10 +257,61 @@ async function sendDiscordMessage(channelId, text, options = {}) { | |||||
| // Convert Slack markdown to Discord markdown | ||||||
| let discordText = text.replace(/<(https?:\/\/[^|>]+)\|([^>]+)>/g, '[$2]($1)'); | ||||||
|
|
||||||
| // Convert common Slack emoji codes to Unicode emoji for Discord | ||||||
| // Use a single regex-based replacement for better performance with large messages | ||||||
| const emojiMap = { | ||||||
| ':notes:': '🎵', | ||||||
| ':lock:': '🔒', | ||||||
| ':star:': '⭐', | ||||||
| ':stopwatch:': '⏱️', | ||||||
| ':cricket:': '🦗', | ||||||
| ':musical_note:': '🎵', | ||||||
| ':headphones:': '🎧', | ||||||
| ':speaker:': '🔊', | ||||||
| ':mute:': '🔇', | ||||||
| ':loud_sound:': '🔊', | ||||||
| ':sound:': '🔉', | ||||||
| ':fire:': '🔥', | ||||||
| ':thumbsup:': '👍', | ||||||
| ':thumbsdown:': '👎', | ||||||
| ':clap:': '👏', | ||||||
| ':party_popper:': '🎉', | ||||||
| ':tada:': '🎉', | ||||||
| ':warning:': '⚠️', | ||||||
| ':x:': '❌', | ||||||
| ':white_check_mark:': '✅', | ||||||
| ':checkmark:': '✅', | ||||||
| ':question:': '❓', | ||||||
| ':exclamation:': '❗', | ||||||
| ':sparkles:': '✨' | ||||||
| }; | ||||||
| discordText = discordText.replace(/:[a-z_]+:/g, (match) => emojiMap[match] || match); | ||||||
|
||||||
| discordText = discordText.replace(/:[a-z_]+:/g, (match) => emojiMap[match] || match); | |
| discordText = discordText.replace(/:[a-z0-9_]+:/gi, (match) => emojiMap[match] || match); |
Copilot
AI
Feb 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new emoji conversion and message chunking logic lacks test coverage. Consider adding tests to verify: 1) emoji codes are correctly converted to Unicode emoji, 2) messages over 1800 characters are properly split into multiple chunks without data loss, 3) the sendChunkSafe helper correctly handles messages that need recursive splitting, 4) edge cases like exact-length lines (line.length === maxLength) are handled properly. The existing test/discord.test.mjs file contains patterns for Discord logic testing that can be followed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The emojiMap is being recreated on every function call. For better performance, move this map to module-level scope (outside the function, similar to how trackMessages is declared at the top). This will eliminate the overhead of recreating the same object every time a Discord message is sent, which can be significant when sending multiple messages in quick succession (like during bulk operations).