213 Commits
Author SHA1 Message Date
NCPlayz fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
SnowyLumaandSnowyLuma 42a7c4f7e5 Add support for guild banners
Document banner attribute of Guild and Invite

Update discord/utils.py

Co-Authored-By: SnowyLuma <38926001+SnowyLuma@users.noreply.github.com>
2019-03-09 00:37:49 -05:00
Rapptz 7d877e9067 Better jpeg detection in utils._get_mime_type_for_image
Fixes #1901
2019-02-23 10:25:05 -05:00
Rapptz 700dbb5555 Fix missing import. 2019-02-06 02:28:59 -05:00
Rapptz e429763dea Try to optimize for the common ASCII case.
This is still a slowdown (about 45ns to 300ns) but it's less severe
than the original implementation (about 900 to 1100ns).
2019-02-06 02:15:22 -05:00
cod d107f485a5 [commands] Fix ext.commands help page full-width indentation
add _string_width function to util. Changed string width calculate
function from len() to util function _string_width().
2019-02-06 02:15:04 -05:00
Dante Dam 9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Valentin 0614e2af90 Use a tuple for startswith in mime detection code. 2019-01-28 21:47:23 -05:00
khazhyk c30b016bb5 Support webp in _get_mime_type_for_image
untested
2018-11-24 23:18:11 -05:00
Hornwitser efb4ff850e [lint] Fix import order
Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
2018-11-24 22:17:58 -05:00
Hornwitser a0634b3eea [lint] Simplyfy util.valid_icon_size
Remove redundant paranthesis and checks from util.valid_icon_size.
2018-11-24 22:17:58 -05:00
Hornwitser 51d626eabe [lint] Remove redundant paranthesis
Remove redundant parenthisis around await expressions.  Left over from
f25091ef.
2018-11-24 22:17:58 -05:00
Matt (IPv4) 3727ea9811 Add Guild.splash_url_as 2018-10-11 02:38:52 -04:00
Rapptz 95d8bb2e85 Change internal representation of roles in Member and Emoji.
Introduce a new internal type, SnowflakeList, which has better memory
footprint over a regular list or set of roles. It is suspected that
there will be a 9x reduction of memory for every Emoji instance and a
48 byte saving per Member instance. However, these savings will
probably only be evident on larger bots.

As a consequence of this change, Member.roles is now computed lazily.

Currently I am not sure if I want to do the initial sorting on the
SnowflakeList for Member, as this comes with a O(n log n) cost when
creating a Member for little purpose since SnowflakeList.has is not
overly relied on. If CPU time becomes an issue this might change.
2018-09-24 22:19:42 -04:00
BeatButton a4d1599ce9 Change docstrings to raw-strings 2018-09-14 22:55:27 -04:00
Hornwitser 119c5a0618 [lint] Remove unused variables
Left over from various refactoring and rewrites.
2018-08-22 21:43:51 -04:00
Rapptz f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
ReinaSakuraba d53cada91e Fix TypeError in utils.oauth_url 2017-10-04 21:27:31 -07:00
Rapptz 5e913b265b Change how coroutines are detected internally. 2017-09-16 13:35:00 -04:00
Rapptz ede1771960 Fix utils.get example. 2017-08-30 01:37:25 -04:00
Rapptz 37b0fdb898 Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.

Fixes #704
2017-08-21 01:57:07 -04:00
khazhyk 0a588fac1c allow trailing null bytes in uploaded jpegs 2017-07-25 06:09:41 -04:00
khazhyk 12ca0d9b16 avatar_url_as improvements
static_format will only apply to static (not animated) avatars. Makes
it easier to grab gif-or-'format' of an avatar. Defaults to 'webp'

This is for a similar usecase to avatar_url_as(format=None), except
one can specify the non-animated format, instead of always using
webp.

add User.avatar_is_animated property.

add validation for avatar_url_as, since invalid arguments result in
a url which will return 415, which can be confusing for a user. (They
just see a blank page)

Discord accepts size=16-2048, but images cap at 1024px, so accept 16-1024
Discord accepts "jpg", "jpeg", "png", "gif", and "webp", *unless* the
avatar is not animated, in which case "gif" is not supported. :\
2017-07-25 06:09:40 -04:00
Rapptz d239cc2666 Implement "partial" message events.
These are events that get triggered regardless of the state of the
message cache. Useful for getting data from before the bot was booted.
2017-06-09 18:36:59 -04:00
Rapptz f588876587 Use Python3Lexer instead of PythonLexer for pygments. 2017-05-22 07:21:23 -04:00
Rapptz 1fc08bc5a2 Remove unused imports. 2017-04-18 04:22:35 -04:00
Rapptz 29f676c42e Wrap asyncio.wait into a saner alternative that raises TimeoutError.
Fixes #494
2017-02-25 00:03:43 -05:00
Rapptz dcf826c09b Allow utils.maybe_coroutine to take any arguments. 2017-02-13 20:58:14 -05:00
Rapptz 47ef657fbd Implement async checks. Fixes #380. 2017-02-12 12:13:23 -05:00
Rapptz ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
SunDwarf e7c5ef181f Allow uploading of GIFs for users.
Discord Nitro accounts can upload GIFs as avatars, so the image
mimetype checker code should check for the GIF magic number too.

Signed-off-by: SunDwarf <l@veriny.tf>
2017-01-08 15:59:27 +00:00
Rapptz d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -05:00
Rapptz 45c729b167 Switch IDs to use int instead of str 2017-01-03 09:51:49 -05:00
Rapptz 7272190e2d Add support for "Do Not Disturb" and "Invisible" statuses.
This deprecates Client.change_status in favour of the newer and more
correct Client.change_presence.
2016-09-26 19:55:42 -04:00
Rapptz 6b5d579d0b Remove unused verify response function. 2016-06-12 20:44:40 -04:00
Rapptz fa36a449e9 Change HTTPException to only take a single parameter. 2016-06-12 13:57:05 -04:00
Khazhismel Kumykov 8e5347f4ed Allow datetime in limit parameters for logs_from.
Add time_snowflake to convert a datetime to a "snowflake".
2016-05-20 18:11:56 -04:00
Rapptz 0c8d5ee863 Force encoding of text retrieval functions to use utf-8.
Closes #207
2016-05-10 19:52:34 -04:00
Rapptz fda0c8cea0 Add compatibility layer for run_coroutine_threadsafe.
This is a breaking change, since discord.utils.create_task is moved
to discord.compat.create_task.
2016-04-25 20:52:16 -04:00
cookie bd5effeb68 Add optional redirect_uri parameter to utils.oauth_url 2016-04-18 00:47:55 -04:00
Khazhismel Kumykov a2a5dc5997 Add optional server parameter to utils.oauth_url 2016-04-15 21:04:33 -04:00
Rapptz eedad13ac1 Add utility function for generating OAuth2 urls. 2016-04-08 22:51:57 -04:00
Rapptz d133f9f761 Clean up documentation of utils.snowflake_time 2016-03-06 03:42:13 -05:00
Khazhismel 612aa4d107 Add util method to extract creation date from discord ids 2016-03-06 03:40:16 -05:00
Rapptz 4d816c4ef3 HTTPException now has a text attribute if JSON is not available. 2016-01-25 01:16:14 -05:00
Rapptz e88bc28236 Documentation fixes to quiet Sphinx warnings. 2016-01-07 00:21:00 -05:00
Rapptz 89a418a388 Add __slots__ for missing classes that didn't have it. 2016-01-06 23:40:20 -05:00
Rapptz db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
Rapptz c69a991e46 Maintain order in role related functions. 2015-12-30 16:11:15 -05:00
Rapptz 7765580a14 utils.get now supports nested attribute retrieval. 2015-12-30 14:48:34 -05:00