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

Parse and display multiple snowflakes #157

Open
p0lygun opened this issue Feb 4, 2022 · 8 comments
Open

Parse and display multiple snowflakes #157

p0lygun opened this issue Feb 4, 2022 · 8 comments
Assignees
Labels
enhancement Improving existing functionality feature Adding new functionality

Comments

@p0lygun
Copy link

p0lygun commented Feb 4, 2022

When you hold shift on a message it opens a new context menu that lets one quickly copy the id but the return value is different
image
returns
423250272316293120-938804470408699954 (channel_id-message-id) instead of just 938803791346679809 (message-id)
currently using this will yield
image

@vegeta897
Copy link
Owner

Interesting, I didn't know about this. What would you expect the result to be?

@p0lygun
Copy link
Author

p0lygun commented Feb 4, 2022

adding something like

snowflake = snowflake.split("-").at(-1)

before https://github.com/vegeta897/snow-stamp/blob/main/src/convert.js#L13 should do the trick as we dont care for the left hand side part after the split

@vegeta897
Copy link
Owner

I'm sort of wondering if it would be better to strip it out of the input box on paste before it reaches validation, because syncing the URL with that two-part snowflake might get kind of messy.

@p0lygun
Copy link
Author

p0lygun commented Feb 4, 2022

yh that is also a good approach, i was just looking at convert js so didnt think of the lol

@vegeta897
Copy link
Owner

The only part I don't like about automatically stripping it out is that it's kind of bad UX if the user doesn't understand what's happening when they see something different than what they pasted.

I could use this opportunity to develop support for pasting in multiple snowflakes. If it detects multiple, however delimited, it could convert the input into a multi-line and show a snowflake on each line, and let you select which one to show the conversion for (with one selected automatically by default, to avoid requiring an extra click in this use-case). The URL would be the selected snowflake.

@vegeta897 vegeta897 added enhancement Improving existing functionality feature Adding new functionality labels Feb 4, 2022
@p0lygun
Copy link
Author

p0lygun commented Feb 4, 2022

i would recommend against it, as take this 423250272316293120-938769477812764682 for an example both of them are valid snowflakes but only one of them is a message timestamp, i believe if we try to convert the first one it should give us when the channel was created, lemme confirm

@vegeta897
Copy link
Owner

vegeta897 commented Feb 4, 2022

If that is the channel ID then yes, it would be when the channel is created.

Snow-Stamp's job is to convert snowflakes to timestamps, so I want to keep the input>output results as unsurprising as possible. Automatically ignoring the first snowflake in a pair like that just because the user likely copied it from a message feels like bad design to me.

By automatically splitting up the input into the two snowflakes, the user can understand what happened and get the result they were looking for, it seems like win/win to me.

@vegeta897
Copy link
Owner

This multi-input idea would also be a good start for implementing #155

Now I have to decide whether I want to do all this before or after a typescript/sveltekit rewrite.

@vegeta897 vegeta897 self-assigned this Feb 5, 2022
@vegeta897 vegeta897 changed the title Allow usage of value returned by hold shift context menu Parse and display multiple snowflakes Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality feature Adding new functionality
Projects
None yet
Development

No branches or pull requests

2 participants