Skip to content
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

Bulk-moving messages #155

Open
4 of 10 tasks
00-kat opened this issue Feb 16, 2025 · 0 comments
Open
4 of 10 tasks

Bulk-moving messages #155

00-kat opened this issue Feb 16, 2025 · 0 comments
Labels
new-feature New feature or request

Comments

@00-kat
Copy link
Contributor

00-kat commented Feb 16, 2025

This is quite similar to the fabled #18; as Ghostty is no longer in a private beta, there isn't much need to create the threads themselves anymore, but mostly just move them.

I've not figured out the exact details yet; I'll edit this as I do that. I also haven't determined the most convenient UX for this.

Some of these aren't necessarily related to bulk-moving, but for normally moving a single message too. While I should probably make a different issue for these, I'm lazy and am going to dump them here.

Checklist:

As these items are completed (or have PRs open), their corresponding details section will also be collapsed.

Nitro emoji handling

  1. Mimic “fake-nitro”; i.e. [emoji-name](link-to-emoji-in-discord-cdn).
    • These break down when you have text other than only a fake-nitro emoji in a message, but ¯\_(ツ)_/¯.
  2. Temporarily add them to the application, falling back to fake-nitro.
  3. Temporarily add them to the server, falling back to fake-nitro.

Update: approach three will not be tried, and approach two will be revisited after the next discord.py version arrives. See also: #157.

Stickers are not stored

Even the built-in Discord stickers aren't stored. Nitro stickers should be given the fake-nitro treatment described above; adding it to the server shall not be considered as there are very limited sticker slots available update: Webhooks cannot add stickers anyway.

VictimsUsers can't delete or edit moved messages

Not sure how long the Webhook survives, so this may not be possible in the first place.
Note to self: add notes about how PluralKit facilitates this here.

Replies are not stored

  1. Fall-back to Markdown quote blocks, perhaps with a heading or two; this was the method used before Discord added replies.
  2. Use an embed (similar to most bridges and PluralKit).

Storing the link that it is replying to would likely be difficult as you need the new one if it's moved, and the old one if it's not. Even worse if it's moved after the fact.

Forwards are not stored

Discord does not support nesting block-quotes, so I'm not sure what to do here. Perhaps faking block quotes with box-drawing characters might work...
Any link people in the server that the message was forwarded from would not be preserved; not much can be done on this front.
Some code that was removed in #154 will need to be reintroduced if this is to be done.

Update: it seems like it is not possible to fetch the content of forwards from servers that the bot is not in.

Poll movement is lossy

Votes aren't moved

If Webhooks can vote, this can be done. Otherwise, this cannot be done.

Update: Webhooks can't vote.

Relevant documentation links: discord.Poll.answers, discord.PollAnswer.voters.

The timer is reset

Not sure if anything can be done about this one.
If the previous one can't be done, this should not be done to give people time to vote again.

Update: the previous one cannot be done.

Moving closed polls error

Full traceback
2025-02-16 16:15:14 ERROR    discord.ui.view Ignoring exception in view <SelectChannel timeout=180.0 children=1> for item <ChannelSelect placeholder='Select a channel' min_values=1 max_values=1 disabled=False>
Traceback (most recent call last):
  File "/path/to/bot/env/lib/python3.12/site-packages/discord/ui/view.py", line 430, in _scheduled_task
    await item.callback(interaction)
  File "/path/to/bot/app/components/move_message.py", line 49, in select_channel
    await move_message_via_webhook(
  File "/path/to/bot/app/utils/webhooks.py", line 52, in move_message_via_webhook
    msg = await webhook.send(
          ^^^^^^^^^^^^^^^^^^^
  File "/path/to/bot/env/lib/python3.12/site-packages/discord/webhook/async_.py", line 1843, in send
    data = await adapter.execute_webhook(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/bot/env/lib/python3.12/site-packages/discord/webhook/async_.py", line 223, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In poll.duration: int32 value should be greater than or equal to 1.

This can probably be mitigated by checking if the poll has ended and fixing up the metadata (probably discord.Poll.expires_at) if so then calling discord.Poll.end on the new poll.

Update: this cannot be fixed as polls created by Webhooks cannot be ended manually.

Ghostty Bot deletes its Zig code blocks and entity mentions

Moving a message like #1234 results in Ghostty Bot deleting its entity mention before people have a chance to move Ghostty Bot's message. It also does not bring back the entity mention in the new place.

If the entity mention or code block is to be recreated rather than moved automatically, reactions to the old entity mention or code block ought to be preserved too.

@trag1c trag1c added the new-feature New feature or request label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants