Add date/time conversion logic - #1
Open
dBozee wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new cog to convert many common formats of datetime strings to a discord epoch timestamp.
Usage / Testing:
This should be able to work by using the new
&convertcommand. This should allow for space delimited strings, such as:"Nov 11, 2025 at 16:00 UTC" "Nov 11, 2025 at 16:00".UTC. This should still auto evaluate to a UTC datetime object and then be converted.2025-11-19T02:05:26ZNovember 11 2025 at 4PMetc.
Command usage:
&convert <format> <timestamp>Below are the
formats with examplesAny failed attempts should be logged to the server log, however, this could be refactored to return in the message as well if wanted.
Side note: If we were to migrate this to allowing for slash commands, it would give unlimited boxes to continue filling, which would get away from needing to wrap strings in double quotes.