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

TypeError when using timezone-aware as RELATIVE_BASE #491

Open
perrinjerome opened this issue Jan 22, 2019 · 1 comment
Open

TypeError when using timezone-aware as RELATIVE_BASE #491

perrinjerome opened this issue Jan 22, 2019 · 1 comment

Comments

@perrinjerome
Copy link

With this snippet:

# dateparser==0.7.0  ( also reproduces on master branch )
import dateparser
import datetime
import pytz

settings = { "RELATIVE_BASE":  datetime.datetime.now().replace(tzinfo=pytz.timezone("Europe/Paris")) }

for input_ in ( "2009-06-01T10:00:00+09:00", "yesterday", "July 5th"):
    print (input_, dateparser.parse(input_), dateparser.parse(input_, settings=settings))

"2009-06-01T10:00:00+09:00" or "yesterday" work as expected, but "July 5th" cause a TypeError: can't compare offset-naive and offset-aware datetimes, that is raised here

@noviluni
Copy link
Collaborator

noviluni commented Jul 1, 2020

Added a comment in this related issue: #679 linking to a draft PR with a possible workaround.

thegamecracks added a commit to thegamecracks/thegamebot that referenced this issue Oct 3, 2021
This fixes scrapinghub/dateparser#491 which has been raising TypeError in the "reminder add" command when parsing absolute dates.
thegamecracks added a commit to thegamecracks/thegamebot that referenced this issue Oct 29, 2021
Provides many improvements to the reminders system and the help command.
The minimum python version is now Python 3.10.

Additions:
- Simple implementation of slash commands (bot/cogs/slash/)
	- Rock Paper Scissors user command
	This cog however has some issues and needs a rewrite.
- Signal Hill cog
	- Returns the server status for SOG

Improvements:
- Reminders cog
	- Restructures reminder commands
		- "showreminder"+"showreminders" merged into "reminder"
		- "addreminder"+"removereminder" are now subcommands of "reminder"
		- Adds "remind" command as shorthand for "reminder add"
	- Adds support for using reminders as announcements;
		Reminder content is no longer placed inside an embed. Alongside push notifications being able to display the content properly, this means it is now possible to mention people with it.
		Members with the Mention Everyone permission are able to use the command to schedule announcements using the extra features documented in the command to avoid immediately pinging members. Mentions are filtered from those that don't have the permission.
		- Adds optional channel argument to create announcements for another channel within the guild
		- Adds "announce" alias for "remind" command
	- Reminders now send to the channel where the command was invoked
	- Limits reminder content to 250 characters (1000 for announcements and DM reminders)
	- Increases max reminders from 5 to 10 and cooldown by 1 second (2/6s)
	- Extends syntax of "reminder remove" to support both single integers and ranges in the same command
	- Uses aware datetimes and discord timestamps
- Signal Hill cog
	- Server statuses
		- Player names are now sorted case-insensitively and excluding markdown
		- Graph cleanup now purges every 3 hours
	- Refactors guildsignal.py into a package, separating the code into four files
	- "whitelist sort": Places unlabeled tickets at the bottom
- Rewrites help command to use buttons + pagination
- "timezone ignore" clears the clock reaction entirely if possible

Tweaks:
- Save settings.json after bot closes
- Replaces usages of avatar with display_avatar
- Refactors tag converters to use ctx.current_parameter

Fixes:
- AttributeError in get_reaction()
- Reminder tasks not being canceled on cog reload
- AttributeError when responding in ButtonConfirmation without an interaction

Other:
- Bumps dateparser to master branch
	- Fixes TypeError when parsing absolute dates in "reminder add" (scrapinghub/dateparser#491)
- Bumps dependencies to work with Python 3.10
- Bumps discord.py to latest commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants