Epoch command#983
Conversation
# Conflicts: # bot/exts/utilities/epoch.py
Akarys42
left a comment
There was a problem hiding this comment.
Works pretty well, just a few things
combine TIMESTAMP_FORMATS and STYLES into one
janine9vn
left a comment
There was a problem hiding this comment.
Thank you for this PR!
Really solid code, I just have some minor feedback and a small bug with the dropdowns.
|
|
||
| **Relative time** | ||
| accepted units: "seconds", "minutes", "hours", "days", "weeks", "months", "years" | ||
| Eg ".epoch in a month 4 days and 2 hours" |
There was a problem hiding this comment.
A question more than anything, is it an arrow limitation that .epoch 6 hours and .epoch in 6 hours produce different results? In my ideal world, .epoch 6 hours would mean the same thing as .epoch in 6 hours
There was a problem hiding this comment.
Yes, it seems a relative time can't be parsed without an in .. or ... ago. I guess it's probably best to mention that in the docstring
There was a problem hiding this comment.
this could maybe be manually adjusted, by inserting "in" if it isn't there, and ago is not there
Shivansh-007
left a comment
There was a problem hiding this comment.
Looks good, few minor comments.
| view = TimestampMenuView(ctx, self._format_dates(date_time), epoch) | ||
| original = await ctx.send(f"`{epoch}`", view=view) | ||
| if await view.wait(): # wait until expiration before removing the dropdown | ||
| await original.edit(view=None) |
There was a problem hiding this comment.
this can error if the message has somehow been deleted when we try to delete it.
Might not worth be changing, given that there's not a wait_for_deletion or anything, so only a mod can delete it.
onerandomusername
left a comment
There was a problem hiding this comment.
My actually most important message wasn't saved by github. Nor was my summary.
Looks pretty good, one comment about api requests :)
janine9vn
left a comment
There was a problem hiding this comment.
*chef's kiss* Thank you for implementing this! Your local events lead who is always in need of converting dates to epoch is very appreciative.
I have 2 small comments but they are by no means blockers.
HassanAbouelela
left a comment
There was a problem hiding this comment.
This is really good. Top-notch stuff, thanks
Relevant Issues
Closes #787
Description
Created an "epoch" command which allows you to convert a word date and time to an epoch (Unix timestamp). The parsing for relative dates is done with
arrow.dehumanize, absolute dates are parsed withdateutil.parser.If the entered string is parsed successfully, the epoch is sent to chat along with a drop-down interaction which allows you to format the epoch as one of the discord timestamp styles


Did you: