3 Commits

Author SHA1 Message Date
e48493b36c Actually block out Python 3.9.7
reference PR https://github.com/iDevision/enhanced-discord.py/pull/93
2021-10-05 21:12:40 -05:00
4931100b44 Advise version incompatibility with Python 3.9.7
Due to a bug in Python 3.9.7, code situations where we call an __init__ function in a subclass will fail with a TypeError. 

This is only a bug within the Python language and was patched out with Python 3.10 and this doesn't affect Python 3.9.6. 

Here, we are advising the incompatibility.
2021-10-05 21:03:05 -05:00
ec1e2add21 Update user-agent (#92) 2021-10-04 21:11:10 +01:00
5 changed files with 5 additions and 26 deletions

View File

@ -41,7 +41,9 @@ Key Features
Installing
----------
**Python 3.8 or higher is required**
**Python 3.8 or higher is required***
***Do not use 3.9.7 as Python 3.9.7 has a bug that causes a TypeError with __init__ methods in subclasses.** View more `here <https://bugs.python.org/issue45121/>`_.
To install the library without full voice support, you can just run the following command:

View File

@ -188,7 +188,7 @@ class HTTPClient:
self.proxy_auth: Optional[aiohttp.BasicAuth] = proxy_auth
self.use_clock: bool = not unsync_clock
user_agent = "DiscordBot (https://github.com/Rapptz/discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}"
user_agent = "DiscordBot (https://github.com/iDevision/enhanced-discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}"
self.user_agent: str = user_agent.format(__version__, sys.version_info, aiohttp.__version__)
def recreate(self) -> None:

View File

@ -84,7 +84,6 @@ __all__ = (
"escape_mentions",
"as_chunks",
"format_dt",
"generate_snowflake",
)
DISCORD_EPOCH = 1420070400000
@ -1021,23 +1020,3 @@ def format_dt(dt: datetime.datetime, /, style: Optional[TimestampStyle] = None)
if style is None:
return f"<t:{int(dt.timestamp())}>"
return f"<t:{int(dt.timestamp())}:{style}>"
def generate_snowflake(dt: Optional[datetime.datetime] = None) -> int:
"""Returns a numeric snowflake pretending to be created at the given date but more accurate and random than time_snowflake.
If No dt is not passed, it makes one from the current time using utcnow.
Parameters
-----------
dt: :class:`datetime.datetime`
A datetime object to convert to a snowflake.
If naive, the timezone is assumed to be local time.
Returns
--------
:class:`int`
The snowflake representing the time given.
"""
dt = dt or utcnow()
return int(dt.timestamp() * 1000 - DISCORD_EPOCH) << 22 | 0x3fffff

View File

@ -1136,8 +1136,6 @@ Utility Functions
.. autofunction:: discord.utils.as_chunks
.. autofunction:: discord.utils.generate_snowflake
.. _discord-api-enums:
Enumerations

View File

@ -70,7 +70,7 @@ setup(
include_package_data=True,
install_requires=requirements,
extras_require=extras_require,
python_requires=">=3.8.0",
python_requires=">=3.8.0, !=3.9.7",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",