Skip to content

Add option to send replies as original author replica#105

Draft
LilasKR wants to merge 1 commit into
Kyrela:mainfrom
LilasKR:codex/20260518-fix
Draft

Add option to send replies as original author replica#105
LilasKR wants to merge 1 commit into
Kyrela:mainfrom
LilasKR:codex/20260518-fix

Conversation

@LilasKR
Copy link
Copy Markdown

@LilasKR LilasKR commented May 18, 2026

Summary

Adds a new Reply Method option to send fixed-link replies as a replica of the original message author instead of the bot.

This was written with Codex, then tested locally.

Context

Reference: Discord report
https://discord.com/channels/1160873160665731134/1215363563791585350

Changes

  • Added a Send as Original Author Replica / Send as %{bot} toggle
  • Sends fixed links through a channel webhook when original author replica mode is enabled
  • Uses the original message author's display name and avatar for the webhook message
  • Disables reply mode when webhook sending is enabled, since webhooks cannot reply
  • Falls back to the normal send path if the webhook cannot be created or retrieved
  • Keeps original message handling under the existing Original Message setting
  • Adds Manage Webhooks permission text, including troubleshooting permissions
  • Updates English and Korean locale strings

Tested

Tested locally after adding the setting column to the local test database.

  • Bot starts successfully
  • Slash commands sync successfully
  • Updated locale YAML files parse successfully
  • Python syntax checks pass for the touched files

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@LilasKR LilasKR force-pushed the codex/20260518-fix branch 2 times, most recently from db978e1 to d9b26b1 Compare May 18, 2026 04:18
@LilasKR LilasKR changed the title [codex] Add original sender profile reply mode Add option to send replies as the original sender May 18, 2026
@LilasKR
Copy link
Copy Markdown
Author

LilasKR commented May 18, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Owner

@Kyrela Kyrela left a comment

Choose a reason for hiding this comment

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

Thanks for this pull request. I haven't tested it yet, but I have a couple issues with the code.

Don't hesitate to debate/argue with me if you don't agree with some of my comments, I'm open to discussion.

On another note, did you fully vibe-coded it, and/or are you a developper? More details about the implication of AI in this PR would be appreciated.

Comment thread database/models/Guild.py
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The PR is missing the migration file related to this change

Comment thread locales/en-US.yml Outdated
name: "Reply method"
description: "Change the behavior on the reply"
content: "**Change what to do on the reply**\n- %{state}\n- %{silent}%{perms}"
content: "**Change what to do on the reply**\n- %{state}\n- %{silent}\n- %{avatar}%{perms}"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why "avatar"? That isn't related to the avatar by any mean

Comment thread locales/en-US.yml Outdated
"false": "🔔 Send with a notification"
original_sender_profile:
button:
"true": "Send as Original Sender Profile"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

"original sender profile" doesn't really makes sense imo. Specifially the "profile" part.

"Sending as fake user/author" would be better imo, but, to be closer with what you wrote, "send as original sender/author replica" might also be a solution.

In any case, any change do the naming here have to be mirrored across every symbols of the PR.

Comment thread locales/en-US.yml Outdated
original_sender_profile:
button:
"true": "Send as Original Sender Profile"
"false": "Send as Bot Profile"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same here : "Send as FixTweet" (with, of course, "FixTweet" as determined by the bot's name) seems more adapted.

Comment thread cogs/link_fix.py Outdated
Comment on lines +140 to +146
if not guild.reply_as_original_sender_profile:
async with Typing(channel):
rendered_links = [link for link in links if await link.render()]
if not rendered_links:
return
not_sent, messages = await send_fixed_links(rendered_links, guild, original_message)
else:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why disabling typing when faking user? It's still a working indicator, so it's kind of important.

Also, If typing had to be disabled, duplicating the code isn't the proper solution.

Comment thread src/settings.py
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It seems to be completely missing the troubleshoot permission update

Comment thread src/settings.py Outdated
self.ctx.guild.update({'reply_silently': self.reply_silently})
await view.refresh(interaction)

async def toggle_reply_as_original_sender_profile(self, view: SettingsView, interaction: discore.Interaction, _) -> None:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

As webhooks can't reply, enabling webhook send should disable the reply method option, both visually and by setting it to "send" in the DB.

Comment thread cogs/link_fix.py Outdated
return links_failed, messages_sent


async def get_or_create_webhook(channel: discore.TextChannel | discore.Thread) -> discore.Webhook | None:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

the typehint for channel isn't good ; this can be a lot more that a TextChannel or a Thread

Comment thread cogs/link_fix.py Outdated
Comment on lines +247 to +251
try:
webhooks = await webhook_channel.webhooks()
except discore.HTTPException:
_logger.exception("Failed to fetch webhooks")
return None
Copy link
Copy Markdown
Owner

@Kyrela Kyrela May 18, 2026

Choose a reason for hiding this comment

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

HTTPException is too broad and catching an error like this hides it. There should be a narrower error handling or no error handling at all, allowing the global error handler to catch it and report it properly.

Comment thread cogs/link_fix.py Outdated
Comment on lines +254 to +258
if w.name == WEBHOOK_NAME and getattr(w.user, 'id', None) == channel.guild.me.id
), None)
if webhook is not None:
return webhook
sent, webhook = await safe_send_coro(webhook_channel.create_webhook(name=WEBHOOK_NAME), forbidden=True)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

WEBHOOK_NAME shouldn't be a variable. Instead, the bot's display name should be used, to avoid confusion and incoherent branding across unofficial instances.

@LilasKR
Copy link
Copy Markdown
Author

LilasKR commented May 18, 2026

Thanks for the review!

I’m a UI/UX designer, not a developer. I can read code to some extent, but most of this was vibe-coded with Codex and then adjusted while testing locally.

I agree with most of your points, and I’ll update the PR.

For the typing indicator: I disabled it in webhook mode because the message is sent by a webhook identity instead of the bot user. In my local test, Discord kept showing the bot as typing for a while even after the webhook message had already been sent.

@LilasKR LilasKR force-pushed the codex/20260518-fix branch from d9b26b1 to 0f1537d Compare May 18, 2026 22:11
@LilasKR LilasKR changed the title Add option to send replies as the original sender Add option to send replies as original author replica May 18, 2026
@LilasKR LilasKR force-pushed the codex/20260518-fix branch from 0f1537d to 451ca15 Compare May 18, 2026 22:17
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