Compare commits

...

280 Commits

Author SHA1 Message Date
Daishiky
4291d4cf31
Update discord/colour.py
Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>
2021-09-20 19:06:53 +02:00
Daishiky
28caab0974
Update discord/colour.py
Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>
2021-09-20 19:06:47 +02:00
Daishiky
f9e0e2b55a
Update colour.py 2021-09-19 18:54:10 +02:00
Daishiky
d2aae4752a
added embed_background color 2021-09-19 18:51:02 +02:00
Tom
9356e385d8
Merge pull request #2 from WhoTheOOF/patch-2
fix my dumb <>
2021-08-27 19:14:51 -07:00
Jadon
6feab9abba
fix my dumb <> 2021-08-27 21:11:40 -05:00
Tom
3bbb1187c9
Merge pull request #1 from WhoTheOOF/patch-1
update links to new links
2021-08-27 19:09:24 -07:00
Jadon
cb3869f39c
update links to new links 2021-08-27 21:07:45 -05:00
iDutchy
2b66f2288c well, that was another failed idea... 2021-07-13 20:06:54 -05:00
iDutchy
00619fc6cd Making progress, almost there... 2021-07-13 19:58:09 -05:00
iDutchy
3056c6f0f4 new attempr 2021-07-13 19:53:19 -05:00
iDutchy
d7a0b0af04 oops 2021-07-13 19:37:14 -05:00
iDutchy
f8bf64c9b7 that failed... 2021-07-13 19:32:30 -05:00
iDutchy
8e6601c2c5 first attempt to shortcuts 2021-07-13 19:28:52 -05:00
iDutchy
2df88ccc27 Apparently a conflict sneaked through 2021-06-25 21:07:02 -05:00
iDutchy
0f3b15f10d Merge branch 'Rapptz-v1.x' 2021-06-25 20:34:02 -05:00
iDutchy
2a32e56873 fix conflict 2021-06-25 20:33:22 -05:00
iDutchy
34f6c5db10 looks like I changed stuff? 2021-06-25 20:29:27 -05:00
Rapptz
462ba84809 Version bump to v1.7.3 2021-06-12 12:09:54 -04:00
Rapptz
9ff979572a Add changelog for v1.7.3 2021-06-12 12:09:38 -04:00
Rapptz
9376fcd69d Fix crash involving stickers 2021-06-12 12:04:25 -04:00
Rapptz
e79321c032 Fix DM channel permissions not having read_messages 2021-06-12 12:01:53 -04:00
Nadir Chowdhury
81457330ed [docs] typo fix 2021-06-12 12:01:14 -04:00
Alex Nørgaard
72dd2381b0 Update docs for (Partial)Message.publish to reflect the actual permissions needed 2021-06-12 12:01:01 -04:00
ChasL
f0c3568ea9 Fix for doc reference to python "raise" statement
:ref:`py:raise` -> :ref:`raise statement <py:raise>`

Before fix the text reads: "...define an on_error handler consisting
of a single empty The raise statement." After fix it should read: 
"...define an on_error handler consisting of a single empty raise
statement."
2021-06-12 12:00:33 -04:00
Rapptz
6a52eea6ff Fix AuditLogEntry.target being incorrect for bulk message delete
Fixes #6851
2021-05-05 00:18:44 -04:00
Rapptz
9d2576e464 Version bump to v1.7.2 2021-05-02 23:35:53 -04:00
Rapptz
69fdf8c67d Add changelog for v1.7.2 2021-05-02 23:35:25 -04:00
iDutchy
917649b1b2 fix conflicts 2021-05-02 21:05:05 -05:00
David
f6c8bfdf0d Clarify ClientUser.verified docs 2021-05-01 10:33:01 -04:00
MrKomodoDragon
5e7357efa5 Fix grammar in the Guild.edit docstring 2021-05-01 10:31:44 -04:00
pikaninja
318166d875 [docs] Update notes for get_user and get_member 2021-05-01 10:31:27 -04:00
HyperGH
648b786bc1 Adjust quickstart to not show commands example 2021-05-01 10:31:00 -04:00
jack1142
ccf7e65c50 Fix documentation for RoleConverter 2021-05-01 10:30:27 -04:00
Kino
eb1d03f8f7 Fix typo within HelpCommand.verify_checks documentation 2021-05-01 10:30:02 -04:00
Nadir Chowdhury
5b98ce1235 [docs] fix docstring of AppInfo 2021-05-01 10:29:31 -04:00
Cryptex
06184dc25f Update lavalink's repo url 2021-05-01 10:28:28 -04:00
Steve C
a9dba2753f [tasks] Move the Loop's sleep to be before exit conditions
This change makes it more so that `Loop.stop()` gracefully makes the
current iteration the final one, by waiting AND THEN returning.
The current implementation is closer to `cancel`, while also not.

I encountered this because I was trying to run a
`@tasks.loop(count=1)`, and inside it I print some text and change the
interval, and in an `after_loop`, I restart the loop.

Without this change, it immediately floods my console, due to
not waiting before executing `after_loop`.
2021-05-01 10:28:00 -04:00
NoName
87dd046c32 Add periods to sticker docs 2021-05-01 10:27:12 -04:00
Nadir Chowdhury
7d37c3a506 [docs] Fix various unresolved references 2021-05-01 10:26:11 -04:00
Steve C
4d47436b02 Fix guild.chunk() not working on evicted guilds
If you're trying to chunk a guild that the bot is not in, 
it'll just hang on the chunk coro forever. It's weird, I know.
2021-05-01 10:24:40 -04:00
numbermaniac
f50877c9b8 Add note to member docs about Spotify limitation 2021-05-01 10:24:07 -04:00
Maya
afca943f16 Fix exception for invalid channel types 2021-05-01 10:22:49 -04:00
Dan Hess
81e3f58f43
Fix async adapter detection in message deletion 2021-04-29 19:21:33 -04:00
iDutchy
523e35e4f3
Merge pull request #17 from TheMoksej/patch-2
add silent feature back to delete() function
2021-04-17 16:57:46 +02:00
Moksej
93da1d920e
didn't mean to remove this 2021-04-17 16:47:15 +02:00
Moksej
cdfd918604
add silent feature back to delete() function
latest commit removed the silent kwarg from the delete function so I'm adding it back
2021-04-17 16:46:06 +02:00
Rapptz
f1130e4985 Fix fail_if_not_exists not being set when constructed with state 2021-04-15 09:00:51 -04:00
pikaninja
187b811836 Add StageChannel to abc.GuildChannel docs 2021-04-15 09:00:09 -04:00
Kino
ff04cab119 [docs] Fix reference to Guild.id 2021-04-15 09:00:09 -04:00
Rapptz
65205a8e39 Fix Intents resolution in the docs 2021-04-15 09:00:09 -04:00
Rapptz
28934001b2 Bring back discord module in discord.ext.commands documentation 2021-04-15 09:00:09 -04:00
Rapptz
af7d93725d Remove current module reference in commands API docs 2021-04-15 09:00:09 -04:00
jack1142
efa6482ac4 Add missing attribute tables 2021-04-15 08:58:32 -04:00
Rapptz
4756485ea4 [commands] Add StageChannelConverter to documentation 2021-04-15 08:58:00 -04:00
Shun Tannai
8b4d7f122c [commands] Update Converter list in ext.commands introduction 2021-04-15 08:57:45 -04:00
Sebastian Law
0d1cf57f62 [docs] add note for possible Embed.type strings 2021-04-15 08:57:25 -04:00
Sebastian Law
3ad795ab6a [docs] add label to basic converters section 2021-04-15 08:57:08 -04:00
iDutchy
a453266cd4 conflict fixes 2021-04-07 18:27:34 -05:00
Rapptz
8517f1e085 Version bump to v1.7.1 2021-04-05 21:21:41 -04:00
Rapptz
0a4be8f83c Update changelog for v1.7.1 2021-04-05 21:21:41 -04:00
Logan
56faa98e4b Fix versionadded not showing in docs for Attachment.content_type 2021-04-05 21:10:55 -04:00
Rapptz
1b2c527fc7 [commands] Fix logic in Cog.has_error_handler() 2021-04-05 21:08:54 -04:00
iDutchy
f1309aa4a1 added Client.get_message 2021-02-11 18:38:33 -06:00
iDutchy
86fd3fb738 conflict fixes 2021-01-14 18:03:09 -06:00
iDutchy
694e5e2861 guess I missed this one 2021-01-12 22:33:47 -06:00
iDutchy
54b5e253c9 another small fix 2021-01-12 22:30:55 -06:00
iDutchy
493fc88d6d fix some docs issues 2021-01-12 22:16:09 -06:00
iDutchy
732cab7c5c Works, so added to dos. + little cleanup 2021-01-12 21:57:23 -06:00
iDutchy
2c650feb98 cant support aiohttp 3.8 yet 2021-01-12 21:41:51 -06:00
iDutchy
316e74a9ec test for silent message deleting 2021-01-12 21:39:41 -06:00
iDutchy
89d2f00911 so eh, lets comment this out for now since using it crashes the machine... 2021-01-05 19:46:05 -06:00
iDutchy
a0d491c71f fix machine crashes? 2021-01-05 19:15:24 -06:00
iDutchy
be0933c928 broke case insensitive prefixes... Oops 2021-01-05 18:57:12 -06:00
iDutchy
db9dd93ad4 docs update + add case_insensitive_prefix 2021-01-05 18:20:23 -06:00
iDutchy
b50b8e903f update docs 2020-12-30 22:19:26 -06:00
iDutchy
57e6c946c9 Merge branch 'master' of https://github.com/iDutchy/discord.py 2020-12-30 18:52:30 -06:00
iDutchy
f4bec507c1 attempt at cog aliases 2020-12-30 18:52:15 -06:00
iDutchy
e090eb66d1
Merge pull request #12 from averwhy/master
fix typo in custom_features
2020-12-05 02:07:45 +01:00
iDutchy
0354036451 fix conflicts 2020-12-04 19:05:58 -06:00
iDutchy
9f54345f5c idk, first attempt at adding docs ig. Probably gonna break so yea... 2020-12-01 02:25:51 -06:00
averwhy
4f3d489135 fix typo in custom_features 2020-11-27 20:22:19 -05:00
iDutchy
6e024871ec fix merge conflict 2020-11-24 17:19:31 -06:00
iDutchy
777c95aab2 update 2020-11-24 17:17:25 -06:00
iDutchy
b058b4730c update changelog 2020-11-19 18:48:07 -06:00
iDutchy
725f08e45d add Color.random 2020-11-19 18:46:42 -06:00
iDutchy
b61b5b7414 type fix 2020-11-18 18:09:18 -06:00
iDutchy
e47ff96c30 docs fix 2020-11-18 18:04:33 -06:00
iDutchy
a2b513bd72 docs fix 2020-11-18 18:02:05 -06:00
iDutchy
9e6461a419 docs fix 2020-11-18 17:57:32 -06:00
iDutchy
690dcdaf2e update docs and add message replies 2020-11-18 17:49:58 -06:00
iDutchy
195bace135 admin alias 2020-11-18 16:41:38 -06:00
iDutchy
ae0f11ce53 add a color 2020-11-04 19:51:07 -06:00
iDutchy
188b69c097 docs update 2020-10-28 21:04:30 -05:00
iDutchy
dea09cb5b3 conflict fix 2020-10-28 21:00:48 -05:00
iDutchy
c223d2e723 better prefix 2020-10-28 20:49:49 -05:00
iDutchy
12de975b69 better prefix 2020-10-28 19:49:13 -05:00
iDutchy
14d8310192 properly checking TextChannel.can_send 2020-10-21 20:06:47 -05:00
iDutchy
c6b417bc7b version bump 2020-10-21 17:54:07 -05:00
iDutchy
3521ae985a added versionadded 2020-10-21 17:44:46 -05:00
iDutchy
2b5490d4cb fixes 2020-10-17 20:22:16 -05:00
iDutchy
18f80a737f hmm 2020-10-17 20:09:06 -05:00
iDutchy
faa566040c final step 2020-10-17 20:04:37 -05:00
iDutchy
2d7b6e239b preparing 2020-10-17 20:03:53 -05:00
iDutchy
09168d880f int() support 2020-10-17 19:14:51 -05:00
iDutchy
24839be99d test 2020-10-17 19:07:04 -05:00
iDutchy
4010f09052 Remove int() support 2020-10-17 18:45:59 -05:00
iDutchy
b9642f785e Remove int() support 2020-10-17 18:45:51 -05:00
iDutchy
d75cd66b90 oh ffs 2020-10-17 18:42:19 -05:00
iDutchy
a09e096d42 add menus 2020-10-08 16:06:18 -05:00
iDutchy
0b8671e3d6 doc update 2020-10-04 02:05:24 +00:00
iDutchy
9e0303cc53 Extra security for not overriding bot.embed_color 2020-10-04 02:03:55 +00:00
iDutchy
e3bce1ba58 add doc 2020-10-04 01:58:06 +00:00
iDutchy
ecd898e62c oop 2020-10-04 01:53:57 +00:00
iDutchy
f96a537b8f oop 2020-10-04 01:11:49 +00:00
iDutchy
36bcbb19ee oop 2020-10-04 01:01:17 +00:00
iDutchy
9fc2fd38dc Another request from shivaco 2020-10-04 00:39:03 +00:00
iDutchy
ea73008ff2 update docs 2020-10-02 00:34:53 +00:00
iDutchy
525ee4be0a update docs 2020-10-02 00:34:01 +00:00
iDutchy
7a56f0b28a requested by shivaco ;) 2020-10-02 00:23:25 +00:00
iDutchy
60d383cb51 oop 2020-10-01 22:45:57 +00:00
iDutchy
4297eed591 hmm 2020-10-01 22:41:02 +00:00
iDutchy
0ed9d8ca6b oop 2020-10-01 22:27:07 +00:00
iDutchy
b5ef2bdec4 oop 2020-10-01 22:24:15 +00:00
iDutchy
768f409a84 hmm 2020-10-01 22:22:53 +00:00
iDutchy
7afaa6dfce hmm 2020-10-01 22:16:20 +00:00
iDutchy
21ea6fe9ac hmm 2020-10-01 22:16:05 +00:00
iDutchy
291237bac9 hmm 2020-10-01 22:11:25 +00:00
iDutchy
397535f1e5 hmm 2020-10-01 22:05:34 +00:00
iDutchy
b13eca9def hmm 2020-10-01 22:01:20 +00:00
iDutchy
e6cf6c4b8c hmm 2020-10-01 21:58:29 +00:00
iDutchy
e91a0d62f7 hmm 2020-10-01 21:55:05 +00:00
iDutchy
0860df8fa5 hmm 2020-10-01 21:53:49 +00:00
iDutchy
1c228f9548 oop 2020-10-01 21:43:22 +00:00
iDutchy
0088ab589b oop 2020-10-01 21:42:00 +00:00
iDutchy
d79bc7c3c9 support for default embed color 2020-10-01 21:37:37 +00:00
iDutchy
5b2c7db90b forgot 2020-10-01 02:27:11 +00:00
iDutchy
cd6f48b39c forgot this 2020-10-01 01:28:20 +00:00
iDutchy
74713b05ee add try_user 2020-10-01 01:24:30 +00:00
iDutchy
7cb96f7ba4 oop again 2020-10-01 01:02:28 +00:00
iDutchy
fe826b7134 changes 2020-10-01 01:01:18 +00:00
iDutchy
db6a7d46a1 oop 2020-10-01 00:34:59 +00:00
iDutchy
fd9ceb30f2 I suck 2020-09-30 23:59:06 +00:00
iDutchy
f514d45f99 oops 2020-09-30 23:56:50 +00:00
iDutchy
57efed682b update docs 2020-09-30 23:54:25 +00:00
iDutchy
f33cfbce0d docs update 2020-09-30 23:49:33 +00:00
iDutchy
e21fb1217e
Merge pull request #8 from iDutchy/owner
add Bot.owners
2020-10-01 01:28:26 +02:00
iDutchy
73ed64c527
add Bot.owners 2020-10-01 01:24:25 +02:00
iDutchy
7356a641b5
Merge pull request #7 from iDutchy/owner
add Bot.owner
2020-10-01 01:22:12 +02:00
iDutchy
447a6a694e
add Bot.owner 2020-10-01 01:20:34 +02:00
iDutchy
7af9f2af94 Merge branch 'Rapptz-neo-docs' 2020-09-30 22:42:38 +00:00
iDutchy
f80b4c166c conflict fix 2020-09-30 22:42:28 +00:00
iDutchy
b98fc6f2f6
Merge pull request #5 from Rapptz/master
1.5 release
2020-10-01 00:18:26 +02:00
iDutchy
c8bd6884dc Merge branch 'Rapptz-master' 2020-09-28 00:42:59 +00:00
iDutchy
64be57b192 fixes 2020-09-28 00:42:27 +00:00
Josh
3cc5e23392
Set maximimum sidebar width 2020-09-23 02:28:17 -04:00
Muhammad Hamza
ba7482921b
[matrix] Style "View Documentation For" dropdown 2020-09-22 20:29:04 -04:00
iDutchy
2774cfd3e9 welp, wasnt aware __hex__ got removed in py3 2020-09-18 01:04:04 +00:00
iDutchy
bbaf3375a8 a fix I think? 2020-09-18 00:54:26 +00:00
iDutchy
d28f0ff35b add hex() support to Color 2020-09-18 00:44:40 +00:00
iDutchy
b2540ee312 Lets add some color! 2020-09-18 00:34:29 +00:00
iDutchy
a67bb723b4 competing type added 2020-09-15 20:34:43 +00:00
iDutchy
5756548a6a Merge branch 'Rapptz-feature/intents' 2020-09-15 00:37:04 +00:00
iDutchy
571ddb5a3e merge conflict fix 2020-09-15 00:36:19 +00:00
Rapptz
6546f63ad7 Add a special exception for required privileged intents 2020-09-14 03:49:21 -04:00
Rapptz
4c56e6da9c Pass default intents if not explicitly given 2020-09-14 03:20:41 -04:00
Rapptz
27b224778b Intern status and overwrite strings 2020-09-14 03:20:41 -04:00
Rapptz
ab049e3eb0 Allow finer grained control over the member cache. 2020-09-14 03:20:36 -04:00
Rapptz
6f22ba8ad0 Raise if member intent is not enabled 2020-09-14 03:20:17 -04:00
Rapptz
f3514a4d53 Don't cache members during guild start up if cache is disabled.
This is mainly a half-implemented commit. There are a few more places
where cache consistency is necessary. In the future there will
probably be a member cache policy enum that will be used and cache
consistency will be tackled in part of that larger refactoring.
2020-09-14 03:20:17 -04:00
Rapptz
141511471e Add Guild.chunk and deprecated Client.request_offline_members 2020-09-14 03:20:16 -04:00
Rapptz
27558ec71a Fix Client.request_offline_members no longer working 2020-09-14 03:20:16 -04:00
Rapptz
a6edb66742 Add versionadded for intents enum 2020-09-14 03:20:16 -04:00
Rapptz
b1de57f299 Explicitly disable the members presence by default 2020-09-14 03:20:16 -04:00
Rapptz
0fc8ac6f80 Fix timeouts due to hitting the gateway rate limit 2020-09-14 03:20:16 -04:00
Rapptz
18141c0cf9 Maximize the amount of concurrency while chunking.
In order to reduce our amount of backpressure we need to limit the
amount of concurrent chunk requests we can have so the gateway buffer
has some time to breathe.
2020-09-14 03:20:16 -04:00
Rapptz
022ec9af1d Check for zombie connections through last received payload
The previous code would check zombie connections depending on whether
HEARTBEAT_ACK was received. Unfortunately when there's exceeding
backpressure the connection can terminate since the HEARTBEAT_ACK is
buffered very far away despite it being there, just not received yet.
2020-09-14 03:20:16 -04:00
Rapptz
9492cb1242 Speed up chunking for guilds with presence intent enabled 2020-09-14 03:20:16 -04:00
Rapptz
a76f9ce8ef Maximize concurrency when chunking on AutoSharded clients 2020-09-14 03:20:16 -04:00
Rapptz
faf1db1583 Use a lock for the gateway rate limiter.
This will allow for higher concurrency in AutoSharded situations where
I can mostly "fire and forget" the chunk requests.
2020-09-14 03:20:15 -04:00
Rapptz
d6defbc6b2 Heartbeats bypass the rate limits for gateway 2020-09-14 03:20:15 -04:00
Rapptz
5db9a3551f All guilds require chunking if opting into it 2020-09-14 03:20:15 -04:00
Rapptz
e8e4886fd8 Handle user updates within GUILD_MEMBER_UPDATE 2020-09-14 03:20:15 -04:00
Rapptz
95bec0dcee Rewrite chunking to work with intents.
This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.
2020-09-14 03:20:15 -04:00
Rapptz
f46257faa6 Add more close codes that can't be handled for reconnecting. 2020-09-14 03:20:15 -04:00
Rapptz
c0a3aaa98c Change unknown cache log warnings from WARNING -> DEBUG 2020-09-14 03:20:15 -04:00
Rapptz
75c24bde16 Handle gateway rate limits by using a rate limiter.
With the new chunking changes this will become necessary and we don't
want to disconnect from having too many outwards requests.
2020-09-14 03:20:15 -04:00
Rapptz
a9cb851a3c Add support for guild intents 2020-09-14 03:20:15 -04:00
iDutchy
43c4d33a4a avatar urls in stead of assets 2020-09-13 23:57:18 +00:00
iDutchy
4b612aeece
Merge pull request #1 from Rapptz/feature/intents
Feature/intents
2020-09-13 05:44:24 +02:00
iDutchy
1791b72f45 Add support for Guild.bots and Guild.humans 2020-09-13 01:17:35 +00:00
Rapptz
77b0ddca7c Raise if member intent is not enabled 2020-09-10 06:46:16 -04:00
Rapptz
61ec62da11 Don't cache members during guild start up if cache is disabled.
This is mainly a half-implemented commit. There are a few more places
where cache consistency is necessary. In the future there will
probably be a member cache policy enum that will be used and cache
consistency will be tackled in part of that larger refactoring.
2020-09-10 05:58:24 -04:00
Rapptz
009a961006 Add Guild.chunk and deprecated Client.request_offline_members 2020-09-10 05:56:48 -04:00
Rapptz
cb211c36bd Fix Client.request_offline_members no longer working 2020-09-10 05:26:35 -04:00
Rapptz
a293d87c77 Add versionadded for intents enum 2020-09-10 05:17:52 -04:00
Rapptz
41fd2740cb Explicitly disable the members presence by default 2020-09-10 05:17:52 -04:00
Rapptz
65f591705d Fix timeouts due to hitting the gateway rate limit 2020-09-10 05:17:52 -04:00
Rapptz
81bfdea9df Maximize the amount of concurrency while chunking.
In order to reduce our amount of backpressure we need to limit the
amount of concurrent chunk requests we can have so the gateway buffer
has some time to breathe.
2020-09-10 05:17:52 -04:00
Rapptz
2129ae29be Check for zombie connections through last received payload
The previous code would check zombie connections depending on whether
HEARTBEAT_ACK was received. Unfortunately when there's exceeding
backpressure the connection can terminate since the HEARTBEAT_ACK is
buffered very far away despite it being there, just not received yet.
2020-09-10 05:17:52 -04:00
Rapptz
82fa967f3c Speed up chunking for guilds with presence intent enabled 2020-09-10 05:17:51 -04:00
Rapptz
fdbe0c4f57 Maximize concurrency when chunking on AutoSharded clients 2020-09-10 05:17:51 -04:00
Rapptz
5837ad0804 Use a lock for the gateway rate limiter.
This will allow for higher concurrency in AutoSharded situations where
I can mostly "fire and forget" the chunk requests.
2020-09-10 05:17:51 -04:00
Rapptz
e6fddbdbe7 Heartbeats bypass the rate limits for gateway 2020-09-10 05:17:51 -04:00
Rapptz
37760e16dd All guilds require chunking if opting into it 2020-09-10 05:17:51 -04:00
Rapptz
fd5faac42b Handle user updates within GUILD_MEMBER_UPDATE 2020-09-10 05:17:50 -04:00
Rapptz
eb641569f7 Rewrite chunking to work with intents.
This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.
2020-09-10 05:17:50 -04:00
Rapptz
51704b10cb Add more close codes that can't be handled for reconnecting. 2020-09-10 05:17:50 -04:00
Rapptz
50a951e3ec Change unknown cache log warnings from WARNING -> DEBUG 2020-09-10 05:17:50 -04:00
Rapptz
63c454eaa0 Handle gateway rate limits by using a rate limiter.
With the new chunking changes this will become necessary and we don't
want to disconnect from having too many outwards requests.
2020-09-10 05:17:50 -04:00
Rapptz
f588834b0c Add support for guild intents 2020-09-10 05:17:50 -04:00
Myst(MysterialPy)
a668623d9f
Make admonition-title un-selectable.
All admonition-title's should now be un-selectable.
2020-09-06 00:24:14 -04:00
Nihaal Sangha
0b020fc339
Add sidebar animation when collapsing 2020-09-01 15:24:03 -04:00
Rapptz
0124abb030 Thicken admonition borders a little 2020-08-31 02:35:38 -04:00
Josh
26cce4fb78
[matrix] Hide hamburger menu on pages without sidebar 2020-08-31 02:27:32 -04:00
Josh
3b90e2e74e
[matrix] Fix JS errors on search results page 2020-08-30 02:55:53 -04:00
jack1142
512d9aaccb
Another take at fixing methods showing up under "Attributes" 2020-08-29 22:22:45 -04:00
Rapptz
39f1f9098e Fix collapsible sidebar not working 2020-08-29 20:39:25 -04:00
Rapptz
994de512cb Use the constructed value in the settings 2020-08-29 20:34:50 -04:00
Muhammad Hamza
597f7e30b8
[matrix] Update model styles 2020-08-29 20:19:49 -04:00
Rapptz
575435b4c9 Fix tooltips in settings and make strings translatable 2020-08-29 20:10:54 -04:00
Rapptz
7d8dae735d Move setting load to DOMContentLoaded 2020-08-29 19:56:28 -04:00
Josh
3ce7ab2fc4
[matrix] Refactor JS & add searchbar to mobile. 2020-08-29 19:17:44 -04:00
Rapptz
2d441cc533 Reduce CSS variable usage 2020-08-29 04:30:35 -04:00
Rapptz
7fec153cd7 Fix versionmodified not being italics 2020-08-29 04:14:08 -04:00
Rapptz
1aa93e70ac Change colour scheme and admonition colours
This should make both themes finally look decent
2020-08-29 04:11:05 -04:00
Josh
42498d26f7
[matrix] Set theme to system preferred by default 2020-08-29 03:57:17 -04:00
Nadir Chowdhury
a9d6d90a8f
[matrix] collapsible sidebar headings 2020-08-28 23:13:20 -04:00
jack1142
d9a2c0c65d
Fix methods from superclass showing under "Attributes" table 2020-08-22 16:26:50 -04:00
Josh
9cbb801fb0
Fix sidebar jank on desktop. 2020-07-22 23:35:51 -04:00
Josh
41153d6d90
Fix issues with horizontal overflow on mobile 2020-07-08 23:23:52 -04:00
Josh
b2b2d5ac96 Default to sans-serif font 2020-07-08 22:54:23 -04:00
Rapptz
c2a46f3b8b Redesign admonitions to look a little better.
Colours still need to be reworked though.
2020-07-01 03:42:58 -04:00
Josh
a53bf2660b
[matrix] Display navbar links on mobile 2020-06-29 19:47:15 -04:00
James
c928fd13f1
Resize favicon to 256x256px for Chrome 2020-06-28 19:15:13 -04:00
Rapptz
597af3a582 Switch icon set over to Material Icons intead of FontAwesome 2020-06-28 18:21:37 -04:00
Rapptz
4ebbeb0f2a Rework attributetable to look prettier 2020-06-28 07:34:04 -04:00
Josh
2a8453828b Fix sidebar scrolling on mobile 2020-06-28 17:42:14 +10:00
Rapptz
7482a5de8d Refactor CSS to use a colour palette and make light theme greyer. 2020-06-28 03:36:59 -04:00
Rapptz
c69f7c7bd8 Make tables scroll if they overflow. 2020-06-27 07:55:47 -04:00
Rapptz
8feb74a018 Revert "Fix table wrapping"
This reverts commit c911cd0dbd06f6c0e774396174fb383fc63d172f.
2020-06-27 07:55:47 -04:00
James
69e2cd0180
Add border radius and padding to inline code 2020-06-27 12:33:51 +01:00
Rapptz
c911cd0dbd Fix table wrapping 2020-06-27 07:08:46 -04:00
Rapptz
f4d53d79df Fix margins in 600px view of settings and label 2020-06-27 06:30:38 -04:00
Josh
f1e9017df1 Fix jank on iPads 2020-06-27 19:42:25 +10:00
Rapptz
0a00aeb335 Show classmethods separately in attribute table 2020-06-27 02:25:50 -04:00
Rapptz
6eba27d98e Alphabetically sort attributetable output 2020-06-27 02:05:23 -04:00
Rapptz
7dd45a422c Show the search bar on mobile 2020-06-27 01:53:41 -04:00
Josh
2ef0695e81
[matrix] General Sidebar cleanup (#5061) 2020-06-27 01:16:37 -04:00
Rapptz
8abd4e1357 Various RTD related fixes. 2020-06-25 03:57:58 -04:00
Josh B
5cb1b109bb Set colours for active sidebar elements 2020-06-08 19:21:44 +10:00
Josh B
3c56240e5f Fix sidebar active link selection 2020-06-01 00:38:37 +10:00
Rapptz
90596485a2 First pass at double header display 2020-05-31 09:12:26 -04:00
Josh B
b78f6a310b Create settings icon for mobile 2020-05-31 00:11:03 +10:00
Rapptz
74bdd8485e Use new HTML5 <section> instead of <div class="section"> 2020-05-30 04:59:31 -04:00
Jens Reidel
f03ecdbc69
[matrix] Search to top, icon
* Search bar to top, magnifying glass

* Remove old file

* Remove empty style directive
2020-05-29 23:42:50 -04:00
Rapptz
d14bf7f412 First pass at centering content for large displays 2020-05-29 09:34:21 -04:00
Rapptz
742b14a705 Add dark theme for codeblocks 2020-05-29 07:23:00 -04:00
Rapptz
71f6b950d1 Actually make overflowing have a scrollbar on mobile 2020-05-29 06:45:44 -04:00
Rapptz
8a94adcbcd Fix codeblock related things with mobile responsiveness. 2020-05-29 06:21:05 -04:00
Josh
a31cf94699
Use default scrollbar for body on webkit browsers 2020-05-29 03:52:56 -04:00
Josh
dc545f570e
[matrix] Modal cleanup
* General modal cleanup

* Remove second scrollbar caused by modal
2020-05-29 03:25:13 -04:00
Josh
24c9e7b5fc
[matrix] Dark Theme
* Apply width restructions to modals and images

* Dark theme 2.0

* Add webkit scrollbar

* Use Object.keys instead of Object.entries where applicable
2020-05-29 02:57:00 -04:00
Rapptz
38529e6e21 Proper padding for the copy button 2020-05-28 02:21:01 -04:00
Rapptz
439081081c Reverse the related links 2020-05-28 01:33:16 -04:00
Rapptz
aedd40e585 Use html_js_files instead of the old approach to add JS files. 2020-05-28 01:07:17 -04:00
Rapptz
da4e345f3d Cleanup copy button CSS and add a hover-over explanation. 2020-05-28 01:06:06 -04:00
Rapptz
4e9fdc6e4f Rewrite the DOM to use CSS grids
This also rewrites the CSS to use CSS variables. Currently this isn't
done to codeblocks however.
2020-05-27 23:43:58 -04:00
NCPlayz
0a8b87cae7 add copy codeblock button
Apply suggestions from code review

Co-authored-by: Danny <Rapptz@users.noreply.github.com>

Change to icon, change according to slice's review
2020-05-27 23:39:11 -04:00
Josh
38a7cbb6a5
[matrix] Add sans-serif font toggle to settings modal
* Add sans serif font toggle

* remove unnecessary boolean comparison from setFont

Co-authored-by: slice <ryaneft@gmail.com>

* Update checkbox title

Co-authored-by: slice <ryaneft@gmail.com>

* General cleanup of settings system

* Apply overflow hidden to modal

Co-authored-by: slice <ryaneft@gmail.com>
2020-05-27 10:05:40 -04:00
Josh
e6712d76d1
[matrix] Create settings modal
* Create settings modal

* Fix issue with spacing after settings button

* Fix issue with modal background on mobile devices

* Add close button to modal

* Add tooltip to close button

* Support closing modal with escape key

* Add missing semicolon to keydown event listener
2020-05-27 02:22:21 -04:00
Josh
1e471b64e6
[matrix] Refactor docs JS
* Refactor custom.js

* Refactor scorer.js

* tables variable shoudn't be in global scope
2020-05-27 00:56:38 -04:00
Nadir Chowdhury
509cc135d4
Add favicon 2020-05-26 23:18:42 -04:00
Rapptz
04cec0ec10 Use actual viewport tag with initial-scale set to 1 2020-05-26 07:04:58 -04:00
Jens Reidel
f2482d4fb3 Add fixed header links, fix some parts of mobile UI
Dynamic content width equal to old one if on 1080p

Fix mobile view

Disable fixed header on mobile
2020-05-25 22:37:01 -04:00
Rapptz
ccb4e0b6e7 Bump Sphinx to 3.0.3 2020-05-25 22:15:46 -04:00
Riley Shaw
3c558af0cb
make documentation sphinx 3.x compatible 2020-05-25 21:39:59 -04:00
Rapptz
2eb9e3bc56 Move table JS outside of scrolling 2020-05-25 12:17:13 -04:00
Rapptz
de9a3b5f60 Bump Sphinx to 2.4.4 2020-05-25 11:55:13 -04:00
Rapptz
771c1c85d8 Add attributetable and add some class-level sections.
The extensions have yet to receive this treatment and CSS needs work,
but for now this is fine.
2020-05-25 11:48:16 -04:00
44 changed files with 7256 additions and 143 deletions

2
.gitignore vendored
View File

@ -14,3 +14,5 @@ docs/crowdin.py
*.jpg *.jpg
*.flac *.flac
*.mo *.mo
dist
build

View File

@ -1,17 +1,19 @@
discord.py Enhanced-dpy (custom discord.py)
========== =================================
.. image:: https://discord.com/api/guilds/336642139381301249/embed.png
:target: https://discord.gg/r3sSKJJ
:alt: Discord server invite
.. image:: https://img.shields.io/pypi/v/discord.py.svg
:target: https://pypi.python.org/pypi/discord.py
:alt: PyPI version info
.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg .. image:: https://img.shields.io/pypi/pyversions/discord.py.svg
:target: https://pypi.python.org/pypi/discord.py :target: https://pypi.python.org/pypi/discord.py
:alt: PyPI supported Python versions :alt: PyPI supported Python versions
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.
Credits to the `original lib by Rapptz <https://github.com/Rapptz/discord.py>`_
**WARNING: This is not the official discord.py library! As of 8/27/2021 Danny (Rapptz) has stopped development due to breaking changes. You are still able to read the official library at https://github.com/Rapptz/discord.py!**
Custom Features
----------------
**Moved to:** `Custom Features <https://enhanced-dpy.readthedocs.io/en/latest/custom_features.html>`_
Key Features Key Features
------------- -------------
@ -31,28 +33,17 @@ To install the library without full voice support, you can just run the followin
.. code:: sh .. code:: sh
# Linux/macOS # Linux/macOS
python3 -m pip install -U discord.py python3 -m pip install -U enhanced-dpy
# Windows # Windows
py -3 -m pip install -U discord.py py -3 -m pip install -U enhanced-dpy
Otherwise to get voice support you should run the following command:
.. code:: sh
# Linux/macOS
python3 -m pip install -U "discord.py[voice]"
# Windows
py -3 -m pip install -U discord.py[voice]
To install the development version, do the following: To install the development version, do the following:
.. code:: sh .. code:: sh
$ git clone https://github.com/Rapptz/discord.py $ git clone https://github.com/iDevision/enhanced-discord.py
$ cd discord.py $ cd enhanced-discord.py
$ python3 -m pip install -U .[voice] $ python3 -m pip install -U .[voice]
@ -109,6 +100,6 @@ You can find more examples in the examples directory.
Links Links
------ ------
- `Documentation <https://discordpy.readthedocs.io/en/latest/index.html>`_ - `Documentation <https://enhanced-dpy.readthedocs.io/en/latest/index.html>`_
- `Official Discord Server <https://discord.gg/r3sSKJJ>`_ - `Official Discord Server <https://discord.gg/wZSH7pz>`_
- `Discord API <https://discord.gg/discord-api>`_ - `Discord API <https://discord.gg/discord-api>`_

View File

@ -13,7 +13,7 @@ __title__ = 'discord'
__author__ = 'Rapptz' __author__ = 'Rapptz'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright 2015-present Rapptz' __copyright__ = 'Copyright 2015-present Rapptz'
__version__ = '2.0.0a' __version__ = '1.7.3.7.post1'
__path__ = __import__('pkgutil').extend_path(__path__, __name__) __path__ = __import__('pkgutil').extend_path(__path__, __name__)
@ -57,8 +57,8 @@ from .team import *
from .sticker import * from .sticker import *
from .interactions import * from .interactions import *
VersionInfo = namedtuple('VersionInfo', 'major minor micro releaselevel serial') VersionInfo = namedtuple('VersionInfo', 'major minor micro enhanced releaselevel serial')
version_info = VersionInfo(major=2, minor=0, micro=0, releaselevel='alpha', serial=0) version_info = VersionInfo(major=1, minor=7, micro=3, enhanced=7, releaselevel='final', serial=0)
logging.getLogger(__name__).addHandler(logging.NullHandler()) logging.getLogger(__name__).addHandler(logging.NullHandler())

View File

@ -176,6 +176,7 @@ class GuildChannel(Protocol):
- :class:`~discord.TextChannel` - :class:`~discord.TextChannel`
- :class:`~discord.VoiceChannel` - :class:`~discord.VoiceChannel`
- :class:`~discord.CategoryChannel` - :class:`~discord.CategoryChannel`
- :class:`~discord.StageChannel`
This ABC must also implement :class:`~discord.abc.Snowflake`. This ABC must also implement :class:`~discord.abc.Snowflake`.
@ -199,6 +200,9 @@ class GuildChannel(Protocol):
def __str__(self): def __str__(self):
return self.name return self.name
def __int__(self):
return self.id
@property @property
def _sorting_bucket(self): def _sorting_bucket(self):
raise NotImplementedError raise NotImplementedError
@ -734,10 +738,10 @@ class GuildChannel(Protocol):
Whether to move the channel to the end of the Whether to move the channel to the end of the
channel list (or category if given). channel list (or category if given).
This is mutually exclusive with ``beginning``, ``before``, and ``after``. This is mutually exclusive with ``beginning``, ``before``, and ``after``.
before: :class:`abc.Snowflake` before: :class:`~discord.abc.Snowflake`
The channel that should be before our current channel. The channel that should be before our current channel.
This is mutually exclusive with ``beginning``, ``end``, and ``after``. This is mutually exclusive with ``beginning``, ``end``, and ``after``.
after: :class:`abc.Snowflake` after: :class:`~discord.abc.Snowflake`
The channel that should be after our current channel. The channel that should be after our current channel.
This is mutually exclusive with ``beginning``, ``end``, and ``before``. This is mutually exclusive with ``beginning``, ``end``, and ``before``.
offset: :class:`int` offset: :class:`int`
@ -747,7 +751,7 @@ class GuildChannel(Protocol):
while a negative number moves it above. Note that this while a negative number moves it above. Note that this
number is relative and computed after the ``beginning``, number is relative and computed after the ``beginning``,
``end``, ``before``, and ``after`` parameters. ``end``, ``before``, and ``after`` parameters.
category: Optional[:class:`abc.Snowflake`] category: Optional[:class:`~discord.abc.Snowflake`]
The category to move this channel under. The category to move this channel under.
If ``None`` is given then it moves it out of the category. If ``None`` is given then it moves it out of the category.
This parameter is ignored if moving a category channel. This parameter is ignored if moving a category channel.
@ -974,6 +978,12 @@ class Messageable(Protocol):
are used instead. are used instead.
.. versionadded:: 1.4 .. versionadded:: 1.4
message_reference: :class:`~discord.MessageReference`
A reference to the :class:`~discord.Message` to which you are replying, i.e. as created using
:meth:`~discord.MessageReference.from_message`. You can control whether this mentions the author
of the referenced Message using :attr:`~discord.AllowedMentions.replied_user`.
.. versionadded:: 1.5.1.5
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`] reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`]
A reference to the :class:`~discord.Message` to which you are replying, this can be created using A reference to the :class:`~discord.Message` to which you are replying, this can be created using

View File

@ -62,30 +62,32 @@ class AppInfo:
A list of RPC origin URLs, if RPC is enabled. A list of RPC origin URLs, if RPC is enabled.
summary: :class:`str` summary: :class:`str`
If this application is a game sold on Discord, If this application is a game sold on Discord,
this field will be the summary field for the store page of its primary SKU this field will be the summary field for the store page of its primary SKU.
.. versionadded:: 1.3 .. versionadded:: 1.3
verify_key: :class:`str` verify_key: :class:`str`
The base64 encoded key for the GameSDK's GetTicket The hex encoded key for verification in interactions and the
GameSDK's `GetTicket <https://discord.com/developers/docs/game-sdk/applications#getticket>`_.
.. versionadded:: 1.3 .. versionadded:: 1.3
guild_id: Optional[:class:`int`] guild_id: Optional[:class:`int`]
If this application is a game sold on Discord, If this application is a game sold on Discord,
this field will be the guild to which it has been linked this field will be the guild to which it has been linked to.
.. versionadded:: 1.3 .. versionadded:: 1.3
primary_sku_id: Optional[:class:`int`] primary_sku_id: Optional[:class:`int`]
If this application is a game sold on Discord, If this application is a game sold on Discord,
this field will be the id of the "Game SKU" that is created, if exists this field will be the id of the "Game SKU" that is created,
if it exists.
.. versionadded:: 1.3 .. versionadded:: 1.3
slug: Optional[:class:`str`] slug: Optional[:class:`str`]
If this application is a game sold on Discord, If this application is a game sold on Discord,
this field will be the URL slug that links to the store page this field will be the URL slug that links to the store page.
.. versionadded:: 1.3 .. versionadded:: 1.3

View File

@ -141,6 +141,13 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
def _sorting_bucket(self): def _sorting_bucket(self):
return ChannelType.text.value return ChannelType.text.value
@property
def can_send(self):
""":class:`bool`: Checks if the bot can send messages
.. versionadded:: 1.5.0.2"""
return self.permissions_for(self.guild.me).send_messages
@utils.copy_doc(discord.abc.GuildChannel.permissions_for) @utils.copy_doc(discord.abc.GuildChannel.permissions_for)
def permissions_for(self, member): def permissions_for(self, member):
base = super().permissions_for(member) base = super().permissions_for(member)
@ -1255,6 +1262,7 @@ class DMChannel(discord.abc.Messageable, Hashable):
""" """
base = Permissions.text() base = Permissions.text()
base.read_messages = True
base.send_tts_messages = False base.send_tts_messages = False
base.manage_messages = False base.manage_messages = False
return base return base
@ -1428,6 +1436,7 @@ class GroupChannel(discord.abc.Messageable, Hashable):
""" """
base = Permissions.text() base = Permissions.text()
base.read_messages = True
base.send_tts_messages = False base.send_tts_messages = False
base.manage_messages = False base.manage_messages = False
base.mention_everyone = True base.mention_everyone = True

View File

@ -24,33 +24,35 @@ DEALINGS IN THE SOFTWARE.
import asyncio import asyncio
import logging import logging
import os
import re
import signal import signal
import sys import sys
import traceback import traceback
import aiohttp import aiohttp
from .user import User
from .invite import Invite
from .template import Template
from .widget import Widget
from .guild import Guild
from .channel import _channel_factory
from .enums import ChannelType
from .mentions import AllowedMentions
from .errors import *
from .enums import Status, VoiceRegion
from .gateway import *
from .activity import BaseActivity, create_activity
from .voice_client import VoiceClient
from .http import HTTPClient
from .state import ConnectionState
from . import utils from . import utils
from .object import Object from .activity import BaseActivity, create_activity
from .backoff import ExponentialBackoff
from .webhook import Webhook
from .iterators import GuildIterator
from .appinfo import AppInfo from .appinfo import AppInfo
from .backoff import ExponentialBackoff
from .channel import _channel_factory
from .colour import Color, Colour
from .enums import ChannelType, Status, VoiceRegion
from .errors import *
from .gateway import *
from .guild import Guild
from .http import HTTPClient
from .invite import Invite
from .iterators import GuildIterator
from .mentions import AllowedMentions
from .object import Object
from .state import ConnectionState
from .template import Template
from .user import User
from .voice_client import VoiceClient
from .webhook import Webhook
from .widget import Widget
__all__ = ( __all__ = (
'Client', 'Client',
@ -167,7 +169,7 @@ class Client:
If this is set to ``False`` then the following features will be disabled: If this is set to ``False`` then the following features will be disabled:
- No user related updates (:func:`on_user_update` will not dispatch) - No user related updates (:func:`on_user_update` will not dispatch)EmptyEmbed
- All member related events will be disabled. - All member related events will be disabled.
- :func:`on_member_update` - :func:`on_member_update`
- :func:`on_member_join` - :func:`on_member_join`
@ -197,6 +199,12 @@ class Client:
sync your system clock to Google's NTP server. sync your system clock to Google's NTP server.
.. versionadded:: 1.3 .. versionadded:: 1.3
embed_color: Union[:class:`.Colour`, :class:`int`]
The default embed color you want to use when initialising a :class:`.Embed`. This will
remove the need to set the color per embed, but can still be overridden by setting a
color while creating an instance of an embed.
.. versionadded:: 1.5.0.1
Attributes Attributes
----------- -----------
@ -211,6 +219,19 @@ class Client:
self._listeners = {} self._listeners = {}
self.shard_id = options.get('shard_id') self.shard_id = options.get('shard_id')
self.shard_count = options.get('shard_count') self.shard_count = options.get('shard_count')
colour = options.get('embed_color', Color.default())
if isinstance(colour, (Color, Colour)):
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(colour))
else:
try:
HEX = re.compile(r'^(#)[A-Fa-f0-9]{6}$')
col = Color(colour)
if HEX.match(str(col)):
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(col))
else:
raise TypeError('The hex value passed could not be converted to a color')
except:
raise TypeError('embed_color must be an instance of discord.Colour or a valid 0x****** hex value.')
connector = options.pop('connector', None) connector = options.pop('connector', None)
proxy = options.pop('proxy', None) proxy = options.pop('proxy', None)
@ -239,6 +260,65 @@ class Client:
# internals # internals
def get_message(self, id):
"""Get a message from cache if the message is still in cache.
.. versionadded:: 1.6.0.7
Parameters
-----------
id: :class:`int`
The message ID to look for.
Returns
--------
Optional[:class:`.Message`]
The message asked for."""
return utils.get(self.cached_messages, id=id)
@property
def embed_color(self):
"""Optional[:class:`.Colour`]: The default embed colour that is
being used for all embed if no colour is passed."""
col = os.getenv("DEFAULT_EMBED_COLOR")
if not col:
return None
return Colour(int(col, 16))
def set_embed_color(self, color):
"""Set a new default embed color.
This will raise a TypeError if an improper format was passed.
.. versionadded:: 1.5.0.1
Parameters
-----------
color: Union[:class:`.Colour`, :class:`int`]
The new color you want to set as default embed color.
Pass either an instance of discord.Color or a valid
0x****** HEX value.
Returns
--------
:class:`.Colour`
The new color that has been set as default embed color.
"""
if isinstance(color, (Color, Colour)):
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(color))
return color
else:
try:
HEX = re.compile(r'^(#)[A-Fa-f0-9]{6}$')
col = Color(color)
if HEX.match(str(col)):
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(col))
return col
else:
raise TypeError('The hex value passed could not be converted to a color')
except:
raise TypeError('embed_color must be an instance of discord.Colour or a valid 0x****** hex value.')
def _get_websocket(self, guild_id=None, *, shard_id=None): def _get_websocket(self, guild_id=None, *, shard_id=None):
return self.ws return self.ws
@ -690,7 +770,7 @@ class Client:
@property @property
def intents(self): def intents(self):
""":class:`Intents`: The intents configured for this connection. """:class:`~discord.Intents`: The intents configured for this connection.
.. versionadded:: 1.5 .. versionadded:: 1.5
""" """
@ -1278,6 +1358,42 @@ class Client:
data['rpc_origins'] = None data['rpc_origins'] = None
return AppInfo(self._connection, data) return AppInfo(self._connection, data)
async def try_user(self, user_id):
"""|coro|
Retrieves a :class:`~discord.User` based on their ID. This can only
be used by bot accounts.
.. versionadded:: 1.5.0.1
.. note::
This will first attempt to get the user from the cache.
If that fails, it will make an API call.
For general usage, consider :meth:`get_user` instead.
Parameters
-----------
user_id: :class:`int`
The user's ID to fetch from.
Raises
-------
:exc:`.NotFound`
A user with this ID does not exist.
:exc:`.HTTPException`
Fetching the user failed.
Returns
--------
:class:`~discord.User`
The user you requested.
"""
user = self.get_user(user_id)
if user is None:
user = await self.fetch_user(user_id)
return user
async def fetch_user(self, user_id): async def fetch_user(self, user_id):
"""|coro| """|coro|
@ -1288,7 +1404,7 @@ class Client:
.. note:: .. note::
This method is an API call. For general usage, consider :meth:`get_user` instead. This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_user` instead.
Parameters Parameters
----------- -----------

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
from __future__ import annotations from __future__ import annotations
import datetime import datetime
import os
from typing import Any, Dict, Final, List, Protocol, TYPE_CHECKING, Type, TypeVar, Union from typing import Any, Dict, Final, List, Protocol, TYPE_CHECKING, Type, TypeVar, Union
from . import utils from . import utils
@ -186,7 +187,13 @@ class Embed:
timestamp: datetime.datetime = None, timestamp: datetime.datetime = None,
): ):
self.colour = colour if colour is not EmptyEmbed else color if colour is EmptyEmbed and color is EmptyEmbed:
colour = os.getenv("DEFAULT_EMBED_COLOR", default=EmptyEmbed)
if isinstance(colour, str):
colour = int(colour, 16)
else:
colour = colour if colour is not EmptyEmbed else color
self.colour = colour
self.title = title self.title = title
self.type = type self.type = type
self.url = url self.url = url

View File

@ -114,6 +114,9 @@ class Emoji(_EmojiTag):
return '<a:{0.name}:{0.id}>'.format(self) return '<a:{0.name}:{0.id}>'.format(self)
return "<:{0.name}:{0.id}>".format(self) return "<:{0.name}:{0.id}>".format(self)
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self) return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)

View File

@ -368,6 +368,8 @@ class AuditLogAction(Enum):
return 'webhook' return 'webhook'
elif v < 70: elif v < 70:
return 'emoji' return 'emoji'
elif v == 73:
return 'channel'
elif v < 80: elif v < 80:
return 'message' return 'message'
elif v < 90: elif v < 90:

View File

@ -24,20 +24,21 @@ DEALINGS IN THE SOFTWARE.
import asyncio import asyncio
import collections import collections
import inspect
import importlib.util import importlib.util
import inspect
import itertools
import sys import sys
import traceback import traceback
import types import types
import discord import discord
from .core import GroupMixin
from .view import StringView
from .context import Context
from . import errors from . import errors
from .help import HelpCommand, DefaultHelpCommand
from .cog import Cog from .cog import Cog
from .context import Context
from .core import GroupMixin
from .help import DefaultHelpCommand, HelpCommand
from .view import StringView
__all__ = ( __all__ = (
'when_mentioned', 'when_mentioned',
@ -99,9 +100,10 @@ class _DefaultRepr:
_default = _DefaultRepr() _default = _DefaultRepr()
class BotBase(GroupMixin): class BotBase(GroupMixin):
def __init__(self, command_prefix, help_command=_default, description=None, **options): def __init__(self, command_prefix, case_insensitive_prefix=False, help_command=_default, description=None, **options):
super().__init__(**options) super().__init__(**options)
self.command_prefix = command_prefix self.command_prefix = command_prefix
self.case_insensitive_prefix = case_insensitive_prefix
self.extra_events = {} self.extra_events = {}
self.__cogs = {} self.__cogs = {}
self.__extensions = {} self.__extensions = {}
@ -131,6 +133,29 @@ class BotBase(GroupMixin):
else: else:
self.help_command = help_command self.help_command = help_command
@property
def owner(self):
""":class:`discord.User`: The owner, retrieved from owner_id. In case of improper caching, this can return None
.. versionadded:: 1.5.0.1"""
if not self.owner_id or self.owner_ids:
raise AttributeError('No owner_id specified or you used owner_ids. If you used owner_ids, please refer to `Bot.owners`')
return self.get_user(self.owner_id)
@property
def owners(self):
"""List[:class:`discord.User`]: The owners, retrieved from owner_ids. In case of improper caching, this list may not contain all owners.
.. versionadded:: 1.5.0.1"""
if not self.owner_ids or self.owner_id:
raise TypeError('No owner_ids specified or you used owner_id. If you used owner_id, please refer to `Bot.owner`')
owners = []
for user in self.owner_ids:
owner = self.get_user(user)
if owner:
owners.append(owner)
return owners
# internal helpers # internal helpers
def dispatch(self, event_name, *args, **kwargs): def dispatch(self, event_name, *args, **kwargs):
@ -511,6 +536,9 @@ class BotBase(GroupMixin):
cog = cog._inject(self) cog = cog._inject(self)
self.__cogs[cog.__cog_name__] = cog self.__cogs[cog.__cog_name__] = cog
if cog.aliases:
for alias in cog.aliases:
self.__cogs[alias] = cog
def get_cog(self, name): def get_cog(self, name):
"""Gets the cog instance requested. """Gets the cog instance requested.
@ -549,6 +577,10 @@ class BotBase(GroupMixin):
if cog is None: if cog is None:
return return
if cog.aliases:
for alias in cog.aliases:
self.__cogs.pop(alias)
help_command = self._help_command help_command = self._help_command
if help_command and help_command.cog is cog: if help_command and help_command.cog is cog:
help_command.cog = None help_command.cog = None
@ -850,6 +882,16 @@ class BotBase(GroupMixin):
if not ret: if not ret:
raise ValueError("Iterable command_prefix must contain at least one prefix") raise ValueError("Iterable command_prefix must contain at least one prefix")
# if self.case_insensitive_prefix:
# if isinstance(ret, list):
# temp = []
# for pre in ret:
# if pre in (self.user.mention + ' ', '<@!%s> ' % self.user.id):
# continue
# temp += list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in pre))))
# ret = temp
# else:
# ret = list(map(''.join, itertools.product(*((c.upper(), c.lower()) for c in ret))))
return ret return ret
async def get_context(self, message, *, cls=Context): async def get_context(self, message, *, cls=Context):
@ -1024,6 +1066,10 @@ class Bot(BotBase, discord.Client):
matches messages starting with ``!?``. This is especially important matches messages starting with ``!?``. This is especially important
when passing an empty string, it should always be last as no prefix when passing an empty string, it should always be last as no prefix
after it will be matched. after it will be matched.
case_insensitive_prefix: :class:`bool`
Wheter the provided command_prefix should be case insensitive or not
.. versionadded:: 1.6.0.7
case_insensitive: :class:`bool` case_insensitive: :class:`bool`
Whether the commands should be case insensitive. Defaults to ``False``. This Whether the commands should be case insensitive. Defaults to ``False``. This
attribute does not carry over to groups. You must set it to every group if attribute does not carry over to groups. You must set it to every group if

View File

@ -89,6 +89,11 @@ class CogMeta(type):
@commands.command(hidden=False) @commands.command(hidden=False)
async def bar(self, ctx): async def bar(self, ctx):
pass # hidden -> False pass # hidden -> False
aliases: :class:`list`
A list of aliases for the cog name.
.. versionadded:: 1.6.0.7
""" """
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
@ -96,6 +101,11 @@ class CogMeta(type):
attrs['__cog_name__'] = kwargs.pop('name', name) attrs['__cog_name__'] = kwargs.pop('name', name)
attrs['__cog_settings__'] = kwargs.pop('command_attrs', {}) attrs['__cog_settings__'] = kwargs.pop('command_attrs', {})
aliases = kwargs.pop('aliases', [])
if not isinstance(aliases, list):
raise TypeError("Cog aliases must be a list, not a {0}".format(type(aliases)))
attrs['aliases'] = aliases
description = kwargs.pop('description', None) description = kwargs.pop('description', None)
if description is None: if description is None:
description = inspect.cleandoc(attrs.get('__doc__', '')) description = inspect.cleandoc(attrs.get('__doc__', ''))

View File

@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
""" """
import re
import discord.abc import discord.abc
import discord.utils import discord.utils
@ -95,6 +96,15 @@ class Context(discord.abc.Messageable):
self.command_failed = attrs.pop('command_failed', False) self.command_failed = attrs.pop('command_failed', False)
self._state = self.message._state self._state = self.message._state
@property
def clean_prefix(self):
""":class:`str`: The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``.
.. versionadded:: 1.5.1.4"""
user = self.guild.me if self.guild else self.bot.user
pattern = re.compile(r"<@!?%s>" % user.id)
return pattern.sub("@%s" % user.display_name.replace('\\', r'\\'), self.prefix)
async def invoke(self, command, /, *args, **kwargs): async def invoke(self, command, /, *args, **kwargs):
r"""|coro| r"""|coro|

View File

@ -157,7 +157,7 @@ class MemberConverter(IDConverter[discord.Member]):
# If we're being rate limited on the WS, then fall back to using the HTTP API # If we're being rate limited on the WS, then fall back to using the HTTP API
# So we don't have to wait ~60 seconds for the query to finish # So we don't have to wait ~60 seconds for the query to finish
try: try:
member = await guild.fetch_member(user_id) member = await guild.try_member(user_id)
except discord.HTTPException: except discord.HTTPException:
return None return None
@ -233,7 +233,7 @@ class UserConverter(IDConverter[discord.User]):
result = ctx.bot.get_user(user_id) or _utils_get(ctx.message.mentions, id=user_id) result = ctx.bot.get_user(user_id) or _utils_get(ctx.message.mentions, id=user_id)
if result is None: if result is None:
try: try:
result = await ctx.bot.fetch_user(user_id) result = await ctx.bot.try_user(user_id)
except discord.HTTPException: except discord.HTTPException:
raise UserNotFound(argument) from None raise UserNotFound(argument) from None
@ -617,8 +617,8 @@ ColorConverter = ColourConverter
class RoleConverter(IDConverter[discord.Role]): class RoleConverter(IDConverter[discord.Role]):
"""Converts to a :class:`~discord.Role`. """Converts to a :class:`~discord.Role`.
All lookups are via the local guild. If in a DM context, then the lookup All lookups are via the local guild. If in a DM context, the converter raises
is done by the global cache. :exc:`.NoPrivateMessage` exception.
The lookup strategy is as follows (in order): The lookup strategy is as follows (in order):

View File

@ -276,7 +276,7 @@ class HelpCommand:
If ``None``, only calls :attr:`.Commands.checks` in a guild setting. If ``None``, only calls :attr:`.Commands.checks` in a guild setting.
If ``False``, never calls :attr:`.Commands.checks`. Defaults to ``True``. If ``False``, never calls :attr:`.Commands.checks`. Defaults to ``True``.
..versionchanged:: 1.7 .. versionchanged:: 1.7
command_attrs: :class:`dict` command_attrs: :class:`dict`
A dictionary of options to pass in for the construction of the help command. A dictionary of options to pass in for the construction of the help command.
This allows you to change the command behaviour without actually changing This allows you to change the command behaviour without actually changing

File diff suppressed because it is too large Load Diff

View File

@ -111,13 +111,13 @@ class Loop:
raise raise
await asyncio.sleep(backoff.delay()) await asyncio.sleep(backoff.delay())
else: else:
await sleep_until(self._next_iteration)
if self._stop_next_iteration: if self._stop_next_iteration:
return return
self._current_loop += 1 self._current_loop += 1
if self._current_loop == self.count: if self._current_loop == self.count:
break break
await sleep_until(self._next_iteration)
except asyncio.CancelledError: except asyncio.CancelledError:
self._is_being_cancelled = True self._is_being_cancelled = True
raise raise

View File

@ -422,6 +422,22 @@ class Intents(BaseFlags):
raise TypeError(f'{key!r} is not a valid flag name.') raise TypeError(f'{key!r} is not a valid flag name.')
setattr(self, key, value) setattr(self, key, value)
@classmethod
def from_list(cls, intents_list):
"""A factory method that creates a :class:`Intents` with everything enabled
that has been passed in the list.
.. versionadded:: 1.5.0.1"""
for item in intents_list:
if item not in cls.VALID_FLAGS.keys():
intents_list.remove(item)
self = cls.none()
for item in intents_list:
setattr(self, item, True)
return self
@classmethod @classmethod
def all(cls: Type[Intents]) -> Intents: def all(cls: Type[Intents]) -> Intents:
"""A factory method that creates a :class:`Intents` with everything enabled.""" """A factory method that creates a :class:`Intents` with everything enabled."""
@ -593,6 +609,7 @@ class Intents(BaseFlags):
@flag_value @flag_value
def presences(self): def presences(self):
""":class:`bool`: Whether guild presence related events are enabled. """:class:`bool`: Whether guild presence related events are enabled.
This corresponds to the following events: This corresponds to the following events:

View File

@ -26,23 +26,23 @@ import copy
from collections import namedtuple from collections import namedtuple
from . import utils from . import utils
from .role import Role
from .member import Member, VoiceState
from .emoji import Emoji
from .errors import InvalidData
from .permissions import PermissionOverwrite
from .colour import Colour
from .errors import InvalidArgument, ClientException
from .channel import *
from .enums import VoiceRegion, ChannelType, try_enum, VerificationLevel, ContentFilter, NotificationLevel
from .mixins import Hashable
from .user import User
from .invite import Invite
from .iterators import AuditLogIterator, MemberIterator
from .widget import Widget
from .asset import Asset from .asset import Asset
from .channel import *
from .colour import Colour
from .emoji import Emoji
from .enums import (ChannelType, ContentFilter, NotificationLevel,
VerificationLevel, VoiceRegion, try_enum)
from .errors import ClientException, InvalidArgument, InvalidData
from .flags import SystemChannelFlags from .flags import SystemChannelFlags
from .integrations import Integration from .integrations import Integration
from .invite import Invite
from .iterators import AuditLogIterator, MemberIterator
from .member import Member, VoiceState
from .mixins import Hashable
from .permissions import PermissionOverwrite
from .role import Role
from .user import User
from .widget import Widget
__all__ = ( __all__ = (
'Guild', 'Guild',
@ -96,7 +96,7 @@ class Guild(Hashable):
The guild owner's ID. Use :attr:`Guild.owner` instead. The guild owner's ID. Use :attr:`Guild.owner` instead.
unavailable: :class:`bool` unavailable: :class:`bool`
Indicates if the guild is unavailable. If this is ``True`` then the Indicates if the guild is unavailable. If this is ``True`` then the
reliability of other attributes outside of :meth:`Guild.id` is slim and they might reliability of other attributes outside of :attr:`Guild.id` is slim and they might
all be ``None``. It is best to not do anything with the guild if it is unavailable. all be ``None``. It is best to not do anything with the guild if it is unavailable.
Check the :func:`on_guild_unavailable` and :func:`on_guild_available` events. Check the :func:`on_guild_unavailable` and :func:`on_guild_available` events.
@ -208,6 +208,9 @@ class Guild(Hashable):
def __str__(self): def __str__(self):
return self.name or '' return self.name or ''
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
attrs = ( attrs = (
('id', self.id), ('id', self.id),
@ -531,6 +534,20 @@ class Guild(Hashable):
"""List[:class:`Member`]: A list of members that belong to this guild.""" """List[:class:`Member`]: A list of members that belong to this guild."""
return list(self._members.values()) return list(self._members.values())
@property
def bots(self):
"""List[:class:`Member`]: A list of bots that belong to this guild.
.. versionadded:: 1.5.0.1"""
return list(m for m in self._members.values() if m.bot)
@property
def humans(self):
"""List[:class:`Member`]: A list of humans that belong to this guild.
.. versionadded:: 1.5.0.1"""
return list(m for m in self._members.values() if not m.bot)
def get_member(self, user_id): def get_member(self, user_id):
"""Returns a member with the given ID. """Returns a member with the given ID.
@ -611,8 +628,8 @@ class Guild(Hashable):
@property @property
def icon_url(self): def icon_url(self):
""":class:`Asset`: Returns the guild's icon asset.""" """:class:`str`: Returns the guild's direct icon url."""
return self.icon_url_as() return str(self.icon_url_as(static_format="png"))
def is_icon_animated(self): def is_icon_animated(self):
""":class:`bool`: Returns True if the guild has an animated icon.""" """:class:`bool`: Returns True if the guild has an animated icon."""
@ -1112,8 +1129,8 @@ class Guild(Hashable):
The new description of the guild. This is only available to guilds that The new description of the guild. This is only available to guilds that
contain ``PUBLIC`` in :attr:`Guild.features`. contain ``PUBLIC`` in :attr:`Guild.features`.
icon: :class:`bytes` icon: :class:`bytes`
A :term:`py:bytes-like object` representing the icon. Only PNG/JPEG supported A :term:`py:bytes-like object` representing the icon. Only PNG/JPEG is supported.
and GIF This is only available to guilds that contain ``ANIMATED_ICON`` in :attr:`Guild.features`. GIF is only available to guilds that contain ``ANIMATED_ICON`` in :attr:`Guild.features`.
Could be ``None`` to denote removal of the icon. Could be ``None`` to denote removal of the icon.
banner: :class:`bytes` banner: :class:`bytes`
A :term:`py:bytes-like object` representing the banner. A :term:`py:bytes-like object` representing the banner.
@ -1313,7 +1330,7 @@ class Guild(Hashable):
def convert(d): def convert(d):
factory, ch_type = _channel_factory(d['type']) factory, ch_type = _channel_factory(d['type'])
if factory is None: if factory is None:
raise InvalidData('Unknown channel type {type} for channel ID {id}.'.format_map(data)) raise InvalidData('Unknown channel type {type} for channel ID {id}.'.format_map(d))
channel = factory(guild=self, state=self._state, data=d) channel = factory(guild=self, state=self._state, data=d)
return channel return channel
@ -1373,6 +1390,42 @@ class Guild(Hashable):
return MemberIterator(self, limit=limit, after=after) return MemberIterator(self, limit=limit, after=after)
async def try_member(self, member_id):
"""|coro|
Retreives a :class:`Member` from a guild ID, and a member ID.
.. versionadded:: 1.5.0.2
.. note::
This will first attempt to get the member from the cache.
If that fails, it will make an API call.
This method is an API call. For general usage, consider :meth:`get_member` instead.
Parameters
-----------
member_id: :class:`int`
The member's ID to fetch from.
Raises
-------
Forbidden
You do not have access to the guild.
HTTPException
Fetching the member failed.
Returns
--------
:class:`Member`
The member from the member ID.
"""
member = self.get_member(member_id)
if member is None:
member = await self.fetch_member(member_id)
return member
async def fetch_member(self, member_id): async def fetch_member(self, member_id):
"""|coro| """|coro|
@ -1380,7 +1433,7 @@ class Guild(Hashable):
.. note:: .. note::
This method is an API call. For general usage, consider :meth:`get_member` instead. This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_member` instead.
Parameters Parameters
----------- -----------
@ -2207,7 +2260,8 @@ class Guild(Hashable):
if not self._state._intents.members: if not self._state._intents.members:
raise ClientException('Intents.members must be enabled to use this.') raise ClientException('Intents.members must be enabled to use this.')
return await self._state.chunk_guild(self, cache=cache) if not self._state.is_guild_evicted(self):
return await self._state.chunk_guild(self, cache=cache)
async def query_members(self, query=None, *, limit=5, user_ids=None, presences=False, cache=True): async def query_members(self, query=None, *, limit=5, user_ids=None, presences=False, cache=True):
"""|coro| """|coro|

View File

@ -192,6 +192,13 @@ class Member(discord.abc.Messageable, _BaseUser):
If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be ``None``. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be ``None``.
activities: Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]] activities: Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]
The activities that the user is currently doing. The activities that the user is currently doing.
.. note::
Due to a Discord API limitation, a user's Spotify activity may not appear
if they are listening to a song with a title longer
than 128 characters. See :issue:`1738` for more information.
guild: :class:`Guild` guild: :class:`Guild`
The guild that the member belongs to. The guild that the member belongs to.
nick: Optional[:class:`str`] nick: Optional[:class:`str`]
@ -225,6 +232,9 @@ class Member(discord.abc.Messageable, _BaseUser):
def __str__(self): def __str__(self):
return str(self._user) return str(self._user)
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
return f'<Member id={self._user.id} name={self._user.name!r} discriminator={self._user.discriminator!r}' \ return f'<Member id={self._user.id} name={self._user.name!r} discriminator={self._user.discriminator!r}' \
f' bot={self._user.bot} nick={self.nick!r} guild={self.guild!r}>' f' bot={self._user.bot} nick={self.nick!r} guild={self.guild!r}>'
@ -444,6 +454,12 @@ class Member(discord.abc.Messageable, _BaseUser):
"""Union[:class:`BaseActivity`, :class:`Spotify`]: Returns the primary """Union[:class:`BaseActivity`, :class:`Spotify`]: Returns the primary
activity the user is currently doing. Could be ``None`` if no activity is being done. activity the user is currently doing. Could be ``None`` if no activity is being done.
.. note::
Due to a Discord API limitation, this may be ``None`` if
the user is listening to a song on Spotify with a title longer
than 128 characters. See :issue:`1738` for more information.
.. note:: .. note::
A user may have multiple activities, these can be accessed under :attr:`activities`. A user may have multiple activities, these can be accessed under :attr:`activities`.

View File

@ -131,6 +131,9 @@ class Attachment(Hashable):
""":class:`bool`: Whether this attachment contains a spoiler.""" """:class:`bool`: Whether this attachment contains a spoiler."""
return self.filename.startswith('SPOILER_') return self.filename.startswith('SPOILER_')
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self) return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
@ -339,6 +342,7 @@ class MessageReference:
self.message_id = utils._get_as_snowflake(data, 'message_id') self.message_id = utils._get_as_snowflake(data, 'message_id')
self.channel_id = int(data.pop('channel_id')) self.channel_id = int(data.pop('channel_id'))
self.guild_id = utils._get_as_snowflake(data, 'guild_id') self.guild_id = utils._get_as_snowflake(data, 'guild_id')
self.fail_if_not_exists = data.get('fail_if_not_exists', True)
self._state = state self._state = state
self.resolved = None self.resolved = None
return self return self
@ -368,6 +372,24 @@ class MessageReference:
self._state = message._state self._state = message._state
return self return self
@classmethod
def from_message(cls, message):
"""Creates a :class:`MessageReference` from an existing :class:`Message`.
.. versionadded:: 1.5.1.5
Parameters
----------
message: :class:`Message`
The message to be converted into a reference.
Returns
-------
:class:`MessageReference`
A reference to the message.
"""
return cls(message._state, message_id=message.id, channel_id=message.channel.id, guild_id=message.guild and message.guild.id)
@property @property
def cached_message(self): def cached_message(self):
"""Optional[:class:`~discord.Message`]: The cached message, if found in the internal message cache.""" """Optional[:class:`~discord.Message`]: The cached message, if found in the internal message cache."""
@ -579,6 +601,12 @@ class Message(Hashable):
except KeyError: except KeyError:
continue continue
def __str__(self):
return self.content
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self) return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)
@ -936,7 +964,7 @@ class Message(Hashable):
if self.type is MessageType.guild_discovery_grace_period_final_warning: if self.type is MessageType.guild_discovery_grace_period_final_warning:
return 'This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery.' return 'This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery.'
async def delete(self, *, delay=None): async def delete(self, *, delay=None, silent=False):
"""|coro| """|coro|
Deletes the message. Deletes the message.
@ -948,12 +976,17 @@ class Message(Hashable):
.. versionchanged:: 1.1 .. versionchanged:: 1.1
Added the new ``delay`` keyword-only parameter. Added the new ``delay`` keyword-only parameter.
.. versionchanged:: 1.6.0.7
Added the new ``silent`` keyword-only parameter.
Parameters Parameters
----------- -----------
delay: Optional[:class:`float`] delay: Optional[:class:`float`]
If provided, the number of seconds to wait in the background If provided, the number of seconds to wait in the background
before deleting the message. If the deletion fails then it is silently ignored. before deleting the message. If the deletion fails then it is silently ignored.
silent: :class:`bool`
If silent is set to ``True``, the error will not be raised, it will be ignored.
This defaults to ``False``
Raises Raises
------ ------
Forbidden Forbidden
@ -973,7 +1006,13 @@ class Message(Hashable):
asyncio.create_task(delete()) asyncio.create_task(delete())
else: else:
await self._state.http.delete_message(self.channel.id, self.id) try:
await self._state.http.delete_message(self.channel.id, self.id)
except Exception as e:
if silent:
pass
else:
raise e
async def edit(self, **fields): async def edit(self, **fields):
"""|coro| """|coro|
@ -1072,8 +1111,10 @@ class Message(Hashable):
Publishes this message to your announcement channel. Publishes this message to your announcement channel.
You must have the :attr:`~Permissions.send_messages` permission to do this.
If the message is not your own then the :attr:`~Permissions.manage_messages` If the message is not your own then the :attr:`~Permissions.manage_messages`
permission is needed. permission is also needed.
Raises Raises
------- -------
@ -1262,8 +1303,8 @@ class Message(Hashable):
async def reply(self, content=None, **kwargs): async def reply(self, content=None, **kwargs):
"""|coro| """|coro|
A shortcut method to :meth:`abc.Messageable.send` to reply to the A shortcut method to :meth:`.abc.Messageable.send` to reply to the
:class:`Message`. :class:`.Message`.
.. versionadded:: 1.6 .. versionadded:: 1.6
@ -1279,7 +1320,7 @@ class Message(Hashable):
Returns Returns
--------- ---------
:class:`Message` :class:`.Message`
The message that was sent. The message that was sent.
""" """

View File

@ -283,6 +283,8 @@ class Permissions(BaseFlags):
""" """
return 1 << 3 return 1 << 3
admin = administrator
@flag_value @flag_value
def manage_channels(self): def manage_channels(self):
""":class:`bool`: Returns ``True`` if a user can edit, delete, or create channels in the guild. """:class:`bool`: Returns ``True`` if a user can edit, delete, or create channels in the guild.

View File

@ -150,6 +150,9 @@ class Role(Hashable):
def __str__(self): def __str__(self):
return self.name return self.name
def __int__(self):
return self.id
def __repr__(self): def __repr__(self):
return '<Role id={0.id} name={0.name!r}>'.format(self) return '<Role id={0.id} name={0.name!r}>'.format(self)

View File

@ -801,6 +801,9 @@ class ConnectionState:
return self._add_guild_from_data(data) return self._add_guild_from_data(data)
def is_guild_evicted(self, guild) -> bool:
return guild.id not in self._guilds
async def chunk_guild(self, guild, *, wait=True, cache=None): async def chunk_guild(self, guild, *, wait=True, cache=None):
cache = cache or self.member_cache_flags.joined cache = cache or self.member_cache_flags.joined
request = self._chunk_requests.get(guild.id) request = self._chunk_requests.get(guild.id)

View File

@ -32,7 +32,7 @@ __all__ = (
) )
class Sticker(Hashable): class Sticker(Hashable):
"""Represents a sticker """Represents a sticker.
.. versionadded:: 1.6 .. versionadded:: 1.6
@ -40,34 +40,34 @@ class Sticker(Hashable):
.. describe:: str(x) .. describe:: str(x)
Returns the name of the sticker Returns the name of the sticker.
.. describe:: x == y .. describe:: x == y
Checks if the sticker is equal to another sticker Checks if the sticker is equal to another sticker.
.. describe:: x != y .. describe:: x != y
Checks if the sticker is not equal to another sticker Checks if the sticker is not equal to another sticker.
Attributes Attributes
---------- ----------
name: :class:`str` name: :class:`str`
The sticker's name The sticker's name.
id: :class:`int` id: :class:`int`
The id of the sticker The id of the sticker.
description: :class:`str` description: :class:`str`
The description of the sticker The description of the sticker.
pack_id: :class:`int` pack_id: :class:`int`
The id of the sticker's pack The id of the sticker's pack.
format: :class:`StickerType` format: :class:`StickerType`
The format for the sticker's image The format for the sticker's image.
image: :class:`str` image: :class:`str`
The sticker's image The sticker's image.
tags: List[:class:`str`] tags: List[:class:`str`]
A list of tags for the sticker A list of tags for the sticker.
preview_image: Optional[:class:`str`] preview_image: Optional[:class:`str`]
The sticker's preview asset hash The sticker's preview asset hash.
""" """
__slots__ = ('_state', 'id', 'name', 'description', 'pack_id', 'format', 'image', 'tags', 'preview_image') __slots__ = ('_state', 'id', 'name', 'description', 'pack_id', 'format', 'image', 'tags', 'preview_image')
@ -76,7 +76,7 @@ class Sticker(Hashable):
self.id = int(data['id']) self.id = int(data['id'])
self.name = data['name'] self.name = data['name']
self.description = data['description'] self.description = data['description']
self.pack_id = int(data['pack_id']) self.pack_id = int(data.get('pack_id', 0))
self.format = try_enum(StickerType, data['format_type']) self.format = try_enum(StickerType, data['format_type'])
self.image = data['asset'] self.image = data['asset']
@ -103,7 +103,7 @@ class Sticker(Hashable):
"""Returns an :class:`Asset` for the sticker's image. """Returns an :class:`Asset` for the sticker's image.
.. note:: .. note::
This will return ``None`` if the format is ``StickerType.lottie`` This will return ``None`` if the format is ``StickerType.lottie``.
Returns Returns
------- -------

View File

@ -46,6 +46,9 @@ class BaseUser(_BaseUser):
def __str__(self): def __str__(self):
return '{0.name}#{0.discriminator}'.format(self) return '{0.name}#{0.discriminator}'.format(self)
def __int__(self):
return self.id
def __eq__(self, other): def __eq__(self, other):
return isinstance(other, _BaseUser) and other.id == self.id return isinstance(other, _BaseUser) and other.id == self.id
@ -94,15 +97,12 @@ class BaseUser(_BaseUser):
@property @property
def avatar_url(self): def avatar_url(self):
""":class:`Asset`: Returns an :class:`Asset` for the avatar the user has. """:class:`str`: Returns an direct url for the avatar the user has.
If the user does not have a traditional avatar, an asset for If the user does not have a traditional avatar, an asset for
the default avatar is returned instead. the default avatar is returned instead.
This is equivalent to calling :meth:`avatar_url_as` with
the default parameters (i.e. webp/gif detection and a size of 1024).
""" """
return self.avatar_url_as(format=None, size=1024) return str(self.avatar_url_as(static_format="png", size=1024))
def is_avatar_animated(self): def is_avatar_animated(self):
""":class:`bool`: Indicates if the user has an animated avatar.""" """:class:`bool`: Indicates if the user has an animated avatar."""
@ -269,7 +269,16 @@ class ClientUser(BaseUser):
.. versionadded:: 1.3 .. versionadded:: 1.3
verified: :class:`bool` verified: :class:`bool`
<<<<<<< HEAD
Specifies if the user's email is verified.
email: Optional[:class:`str`]
The email the user used when registering.
.. deprecated:: 1.7
=======
Specifies if the user is a verified account. Specifies if the user is a verified account.
>>>>>>> 523e35e4f3c3c49d4e471359f9fb559242bbecc8
locale: Optional[:class:`str`] locale: Optional[:class:`str`]
The IETF language tag used to identify the language the user is using. The IETF language tag used to identify the language the user is using.
mfa_enabled: :class:`bool` mfa_enabled: :class:`bool`

View File

@ -73,7 +73,7 @@ class VoiceProtocol:
These classes are passed to :meth:`abc.Connectable.connect`. These classes are passed to :meth:`abc.Connectable.connect`.
.. _Lavalink: https://github.com/Frederikam/Lavalink .. _Lavalink: https://github.com/freyacodes/Lavalink
Parameters Parameters
------------ ------------

View File

@ -597,7 +597,7 @@ class WebhookMessage(Message):
""" """
if delay is not None: if delay is not None:
if self._state.parent._adapter.is_async(): if self._state._webhook._adapter.is_async():
return self._delete_delay_async(delay) return self._delete_delay_async(delay)
else: else:
return self._delete_delay_sync(delay) return self._delete_delay_sync(delay)

View File

@ -95,3 +95,9 @@ document.addEventListener('keydown', (event) => {
activeModal.close(); activeModal.close();
} }
}); });
document.addEventListener('keydown', (event) => {
if (event.code == "Escape" && activeModal) {
activeModal.close();
}
});

View File

@ -271,6 +271,12 @@ header > nav.mobile-only {
header > nav.mobile-only .search { header > nav.mobile-only .search {
width: 100%; width: 100%;
position: absolute;
top: 0;
right: 0;
z-index: -1;
padding-top: 0;
transition: top 0.5s ease-in-out;
} }
header > nav.mobile-only .search-wrapper { header > nav.mobile-only .search-wrapper {

View File

@ -267,7 +267,7 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If you want exception to propagate out of the :class:`Client` class If you want exception to propagate out of the :class:`Client` class
you can define an ``on_error`` handler consisting of a single empty you can define an ``on_error`` handler consisting of a single empty
:ref:`py:raise`. Exceptions raised by ``on_error`` will not be :ref:`raise statement <py:raise>`. Exceptions raised by ``on_error`` will not be
handled in any way by :class:`Client`. handled in any way by :class:`Client`.
.. note:: .. note::
@ -834,7 +834,7 @@ to handle it, which defaults to print a traceback and ignoring the exception.
:type member: :class:`Member` :type member: :class:`Member`
:param before: The voice state prior to the changes. :param before: The voice state prior to the changes.
:type before: :class:`VoiceState` :type before: :class:`VoiceState`
:param after: The voice state after to the changes. :param after: The voice state after the changes.
:type after: :class:`VoiceState` :type after: :class:`VoiceState`
.. function:: on_member_ban(guild, user) .. function:: on_member_ban(guild, user)
@ -2791,6 +2791,8 @@ Role
RoleTags RoleTags
~~~~~~~~~~ ~~~~~~~~~~
.. attributetable:: RoleTags
.. autoclass:: RoleTags() .. autoclass:: RoleTags()
:members: :members:
@ -3051,24 +3053,32 @@ AllowedMentions
MessageReference MessageReference
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
.. attributetable:: MessageReference
.. autoclass:: MessageReference .. autoclass:: MessageReference
:members: :members:
PartialMessage PartialMessage
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
.. attributetable:: PartialMessage
.. autoclass:: PartialMessage .. autoclass:: PartialMessage
:members: :members:
Intents Intents
~~~~~~~~~~ ~~~~~~~~~~
.. attributetable:: Intents
.. autoclass:: Intents .. autoclass:: Intents
:members: :members:
MemberCacheFlags MemberCacheFlags
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
.. attributetable:: MemberCacheFlags
.. autoclass:: MemberCacheFlags .. autoclass:: MemberCacheFlags
:members: :members:
@ -3147,24 +3157,32 @@ PermissionOverwrite
ShardInfo ShardInfo
~~~~~~~~~~~ ~~~~~~~~~~~
.. attributetable:: ShardInfo
.. autoclass:: ShardInfo() .. autoclass:: ShardInfo()
:members: :members:
SystemChannelFlags SystemChannelFlags
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
.. attributetable:: SystemChannelFlags
.. autoclass:: SystemChannelFlags() .. autoclass:: SystemChannelFlags()
:members: :members:
MessageFlags MessageFlags
~~~~~~~~~~~~ ~~~~~~~~~~~~
.. attributetable:: MessageFlags
.. autoclass:: MessageFlags() .. autoclass:: MessageFlags()
:members: :members:
PublicUserFlags PublicUserFlags
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
.. attributetable:: PublicUserFlags
.. autoclass:: PublicUserFlags() .. autoclass:: PublicUserFlags()
:members: :members:

View File

@ -348,4 +348,4 @@ def setup(app):
if app.config.language == 'ja': if app.config.language == 'ja':
app.config.intersphinx_mapping['py'] = ('https://docs.python.org/ja/3', None) app.config.intersphinx_mapping['py'] = ('https://docs.python.org/ja/3', None)
app.config.html_context['discord_invite'] = 'https://discord.gg/nXzj3dg' app.config.html_context['discord_invite'] = 'https://discord.gg/nXzj3dg'
app.config.resource_links['discord'] = 'https://discord.gg/nXzj3dg' app.config.resource_links['discord'] = 'https://discord.gg/nXzj3dg'

34
docs/custom_features.rst Normal file
View File

@ -0,0 +1,34 @@
.. currentmodule:: discord
.. _custom_features:
Intro
=====
enhanced-dpy was made to add some extra features that make it just a bit easier. This custom version of discord.py will always remain up-to-date with the beta version, so not everything might work or be stable.
Custom Features
---------------
Here are the custom features listed that have been added to enhanced-dpy. You can refer to the changelog to see in what version they were added!
- **Documentation URL:** https://enhanced-dpy.readthedocs.io/en/latest/index.html
- Added :attr:`Guild.bots` and :attr:`Guild.humans`
- Added :attr:`Client.owner` and :attr:`Client.owners`
- Added :meth:`Client.try_user`
- :attr:`Guild.icon_url` and :attr:`User.avatar_url` return the string in stead of Asset. use icon/avatar url_as to get the :class:`Asset`
- Merged in ext-colors (https://github.com/MGardne8/DiscordPyColours)
- Using Rapptz/discord.py/tree/neo-docs for documentation
- Added support for ``hex()`` to :class:`Color`
- Added :attr:`Client.embed_color`
- Added :meth:`Client.set_embed_color`
- Added :attr:`TextChannel.can_send`
- Added :meth:`Intents.from_list`
- Added support for ``int()`` to :class:`User`, :class:`Member`, :class:`Emoji`, :class:`Role`, :class:`Guild`, :class:`Message`, :class:`TextChannel`, :class:`VoiceChannel`, :class:`CategoryChannel`, :class:`Attachment` and :class:`Message`. This will return their id
- Added support for ``str()`` to :class:`Message`. This will return the message content
- Added :meth:`Guild.try_member`
- Added :attr:`Context.clean_prefix <.ext.commands.Context.clean_prefix>`
- Added :meth:`Colour.nitro_booster`
- Added :attr:`Permissions.admin` as alias to :attr:`Permissions.administrator`
- Added :attr:`CogMeta.aliases <.ext.commands.CogMeta.aliases>`
- Added :attr:`Bot.case_insensitive_prefix <.ext.commands.Bot.case_insensitive_prefix>`
- Added ``silent`` kwarg to :meth:`Message.delete`
- Added :meth:`Client.get_message`

View File

@ -176,7 +176,8 @@ Paginator
Enums Enums
------ ------
.. class:: discord.ext.commands.BucketType .. class:: BucketType
:module: discord.ext.commands
Specifies a type of bucket for, e.g. a cooldown. Specifies a type of bucket for, e.g. a cooldown.
@ -293,6 +294,9 @@ Converters
.. autoclass:: discord.ext.commands.StoreChannelConverter .. autoclass:: discord.ext.commands.StoreChannelConverter
:members: :members:
.. autoclass:: discord.ext.commands.StageChannelConverter
:members:
.. autoclass:: discord.ext.commands.CategoryChannelConverter .. autoclass:: discord.ext.commands.CategoryChannelConverter
:members: :members:

View File

@ -327,7 +327,7 @@ For example, a common idiom would be to have a class and a converter for that cl
else: else:
await ctx.send("Hm you're not so new.") await ctx.send("Hm you're not so new.")
This can get tedious, so an inline advanced converter is possible through a ``classmethod`` inside the type: This can get tedious, so an inline advanced converter is possible through a :func:`classmethod` inside the type:
.. code-block:: python3 .. code-block:: python3
@ -379,6 +379,10 @@ A lot of discord models work out of the gate as a parameter:
- :class:`PartialMessage` (since v1.7) - :class:`PartialMessage` (since v1.7)
- :class:`TextChannel` - :class:`TextChannel`
- :class:`VoiceChannel` - :class:`VoiceChannel`
<<<<<<< HEAD
- :class:`StageChannel` (since v1.7)
=======
>>>>>>> 523e35e4f3c3c49d4e471359f9fb559242bbecc8
- :class:`StoreChannel` (since v1.7) - :class:`StoreChannel` (since v1.7)
- :class:`CategoryChannel` - :class:`CategoryChannel`
- :class:`Invite` - :class:`Invite`
@ -410,8 +414,15 @@ converter is given below:
+--------------------------+-------------------------------------------------+ +--------------------------+-------------------------------------------------+
| :class:`VoiceChannel` | :class:`~ext.commands.VoiceChannelConverter` | | :class:`VoiceChannel` | :class:`~ext.commands.VoiceChannelConverter` |
+--------------------------+-------------------------------------------------+ +--------------------------+-------------------------------------------------+
<<<<<<< HEAD
| :class:`StageChannel` | :class:`~ext.commands.StageChannelConverter` |
+--------------------------+-------------------------------------------------+
| :class:`StoreChannel` | :class:`~ext.commands.StoreChannelConverter` | | :class:`StoreChannel` | :class:`~ext.commands.StoreChannelConverter` |
+--------------------------+-------------------------------------------------+ +--------------------------+-------------------------------------------------+
=======
| :class:`StoreChannel` | :class:`~ext.commands.StoreChannelConverter` |
+--------------------------+-------------------------------------------------+
>>>>>>> 523e35e4f3c3c49d4e471359f9fb559242bbecc8
| :class:`CategoryChannel` | :class:`~ext.commands.CategoryChannelConverter` | | :class:`CategoryChannel` | :class:`~ext.commands.CategoryChannelConverter` |
+--------------------------+-------------------------------------------------+ +--------------------------+-------------------------------------------------+
| :class:`Invite` | :class:`~ext.commands.InviteConverter` | | :class:`Invite` | :class:`~ext.commands.InviteConverter` |

View File

@ -27,7 +27,7 @@ An example extension looks like this:
def setup(bot): def setup(bot):
bot.add_command(hello) bot.add_command(hello)
In this example we define a simple command, and when the extension is loaded this command is added to the bot. Now the final step to this is loading the extension, which we do by calling :meth:`.commands.Bot.load_extension`. To load this extension we call ``bot.load_extension('hello')``. In this example we define a simple command, and when the extension is loaded this command is added to the bot. Now the final step to this is loading the extension, which we do by calling :meth:`.Bot.load_extension`. To load this extension we call ``bot.load_extension('hello')``.
.. admonition:: Cogs .. admonition:: Cogs
:class: helpful :class: helpful
@ -41,7 +41,7 @@ In this example we define a simple command, and when the extension is loaded thi
Reloading Reloading
----------- -----------
When you make a change to the extension and want to reload the references, the library comes with a function to do this for you, :meth:`Bot.reload_extension`. When you make a change to the extension and want to reload the references, the library comes with a function to do this for you, :meth:`.Bot.reload_extension`.
.. code-block:: python3 .. code-block:: python3

31
docs/ext/menus/index.rst Normal file
View File

@ -0,0 +1,31 @@
.. _discord_ext_menus:
``discord.ext.menus``
====================================================
Something something OOOOOOHH built in paginator!
Recipes
---------
Idk, some examples someday
.. _ext_menus_api:
API Reference
---------------
.. autoclass:: discord.ext.menus.Menu()
:members:
.. autoclass:: discord.ext.menus.PageSource()
:members:
.. autoclass:: discord.ext.menus.MenuPages()
:members:
.. autoclass:: discord.ext.menus.ListPageSource()
:members:
.. autofunction:: discord.ext.tasks.menus

View File

@ -234,7 +234,7 @@ technically in another thread, we must take caution in calling thread-safe opera
us, :mod:`asyncio` comes with a :func:`asyncio.run_coroutine_threadsafe` function that allows us to call us, :mod:`asyncio` comes with a :func:`asyncio.run_coroutine_threadsafe` function that allows us to call
a coroutine from another thread. a coroutine from another thread.
However, this function returns a :class:`concurrent.Future` and to actually call it we have to fetch its result. Putting all of However, this function returns a :class:`~concurrent.futures.Future` and to actually call it we have to fetch its result. Putting all of
this together we can do the following: :: this together we can do the following: ::
def my_after(error): def my_after(error):
@ -295,7 +295,7 @@ How do I make a web request?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To make a request, you should use a non-blocking library. To make a request, you should use a non-blocking library.
This library already uses and requires a 3rd party library for making requests, ``aiohttp``. This library already uses and requires a 3rd party library for making requests, :doc:`aiohttp <aio:index>`.
Quick example: :: Quick example: ::
@ -393,7 +393,7 @@ Example: ::
How do I make a subcommand? How do I make a subcommand?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the ``group`` decorator. This will transform the callback into a ``Group`` which will allow you to add commands into Use the :func:`~ext.commands.group` decorator. This will transform the callback into a :class:`~ext.commands.Group` which will allow you to add commands into
the group operating as "subcommands". These groups can be arbitrarily nested as well. the group operating as "subcommands". These groups can be arbitrarily nested as well.
Example: :: Example: ::

View File

@ -11,8 +11,17 @@ Welcome to discord.py
discord.py is a modern, easy to use, feature-rich, and async ready API wrapper discord.py is a modern, easy to use, feature-rich, and async ready API wrapper
for Discord. for Discord.
Credits to the `original lib by Rapptz <https://github.com/iDutchy/discord.py>`_
**Features:** **WARNING: This is not the official discord.py lib! This is a custom version to which I add some features that might be useful or just makes things easier for the lazy people. See below which features have been added. This lib will also be kept updated with the BETA version of the original lib! So things may be unstable, please keep that in mind.**
Custom Features
---------------
**Moved to:** `Custom Features <https://enhanced-dpy.readthedocs.io/en/latest/custom_features.html>`_
Features
--------
- Modern Pythonic API using ``async``\/``await`` syntax - Modern Pythonic API using ``async``\/``await`` syntax
- Sane rate limit handling that prevents 429s - Sane rate limit handling that prevents 429s

View File

@ -52,8 +52,9 @@ There's a lot going on here, so let's walk you through it step by step.
4. Since the :func:`on_message` event triggers for *every* message received, we have to make 4. Since the :func:`on_message` event triggers for *every* message received, we have to make
sure that we ignore messages from ourselves. We do this by checking if the :attr:`Message.author` sure that we ignore messages from ourselves. We do this by checking if the :attr:`Message.author`
is the same as the :attr:`Client.user`. is the same as the :attr:`Client.user`.
5. Afterwards, we check if the :class:`Message.content` starts with ``'$hello'``. If it is, 5. Afterwards, we check if the :class:`Message.content` starts with ``'$hello'``. If it does,
then we send a message in the channel it was used in with ``'Hello!'``. then we send a message in the channel it was used in with ``'Hello!'``. This is a basic way of
handling commands, which can be later automated with the :ref:`ext.commands` framework.
6. Finally, we run the bot with our login token. If you need help getting your token or creating a bot, 6. Finally, we run the bot with our login token. If you need help getting your token or creating a bot,
look in the :ref:`discord-intro` section. look in the :ref:`discord-intro` section.

View File

@ -11,6 +11,29 @@ Changelog
This page keeps a detailed human friendly rendering of what's new and changed This page keeps a detailed human friendly rendering of what's new and changed
in specific versions. in specific versions.
.. _vp1p7p3:
v1.7.3
--------
Bug Fixes
~~~~~~~~~~
- Fix a crash involving guild uploaded stickers
- Fix :meth:`DMChannel.permissions_for` not having :attr:`Permissions.read_messages` set.
.. _vp1p7p2:
v1.7.2
-------
Bug Fixes
~~~~~~~~~~~
- Fix ``fail_if_not_exists`` causing certain message references to not be usable within :meth:`abc.Messageable.send` and :meth:`Message.reply` (:issue:`6726`)
- Fix :meth:`Guild.chunk` hanging when the user left the guild. (:issue:`6730`)
- Fix loop sleeping after final iteration rather than before (:issue:`6744`)
.. _vp1p7p1: .. _vp1p7p1:
v1.7.1 v1.7.1
@ -32,9 +55,10 @@ Likewise, **this is the last version to support user bots**.
Development of v2.0 will have breaking changes and support for newer API features. Development of v2.0 will have breaking changes and support for newer API features.
New Features <<<<<<< HEAD
~~~~~~~~~~~~~~ =======
>>>>>>> 523e35e4f3c3c49d4e471359f9fb559242bbecc8
- Add support for stage channels via :class:`StageChannel` (:issue:`6602`, :issue:`6608`) - Add support for stage channels via :class:`StageChannel` (:issue:`6602`, :issue:`6608`)
- Add support for :attr:`MessageReference.fail_if_not_exists` (:issue:`6484`) - Add support for :attr:`MessageReference.fail_if_not_exists` (:issue:`6484`)
- By default, if the message you're replying to doesn't exist then the API errors out. - By default, if the message you're replying to doesn't exist then the API errors out.
@ -104,6 +128,19 @@ Miscellaneous
- :class:`Permission` class methods were updated to match the UI of the Discord client (:issue:`6476`) - :class:`Permission` class methods were updated to match the UI of the Discord client (:issue:`6476`)
- ``_`` and ``-`` characters are now stripped when making a new cog using the ``discord`` package (:issue:`6313`) - ``_`` and ``-`` characters are now stripped when making a new cog using the ``discord`` package (:issue:`6313`)
.. _vp1p6p0p7:
v1.6.0.7
--------
New Features
~~~~~~~~~~~~~~
- Add :attr:`CogMeta.aliases <.ext.commands.CogMeta.aliases>`
- Add :attr:`Bot.case_insensitive_prefix <.ext.commands.Bot.case_insensitive_prefix>`
- Add ``silent`` kwargs to :meth:`Message.delete`
- Add :meth:`Client.get_message`
.. _vp1p6p0: .. _vp1p6p0:
v1.6.0 v1.6.0
@ -176,6 +213,49 @@ Miscellaneous
- |commands| :class:`UserConverter <ext.commands.UserConverter>` now fetches the API if an ID is passed and the user is not cached. - |commands| :class:`UserConverter <ext.commands.UserConverter>` now fetches the API if an ID is passed and the user is not cached.
- |commands| :func:`max_concurrency <ext.commands.max_concurrency>` is now called before cooldowns (:issue:`6172`) - |commands| :func:`max_concurrency <ext.commands.max_concurrency>` is now called before cooldowns (:issue:`6172`)
.. _vp1p5p1p6:
v1.5.1.6
--------
New Features
~~~~~~~~~~~~~~
- Add :meth:`Colour.random`
.. _vp1p5p1p5:
v1.5.1.5
--------
New Features
~~~~~~~~~~~~~~
- Add :meth:`Colour.nitro_booster`
- Add :attr:`Permissions.admin` as alias to :attr:`Permissions.administrator`
New Beta Features
~~~~~~~~~~~~~~~~~~~
These are all for message replies. I have added them to 1.5.1.5 but they will most likely officially get added in the original lib in 1.6 or 2.0
- |commands| Add :meth:`Context.reply <ext.commands.Context>`
- Add :meth:`Message.reply`
- Add ``replied_user`` to :class:`AllowedMentions`
- Add :meth:`MessageReference.to_dict`
- Add :meth:`MessageReference.from_message`
- Add ``message_reference`` kwarg to :meth:`abc.Messageable.send`
.. _vp1p5p1p4:
v1.5.1.4
--------
New Features
~~~~~~~~~~~~~~
- |commands| Add :attr:`Context.clean_prefix <ext.commands.Context>`
.. _vp1p5p1: .. _vp1p5p1:
v1.5.1 v1.5.1
@ -201,6 +281,52 @@ Miscellaneous
- This is the same as having ``discord.Member`` as the type-hint. - This is the same as having ``discord.Member`` as the type-hint.
- :meth:`Guild.chunk` now allows concurrent calls without spamming the gateway with requests. - :meth:`Guild.chunk` now allows concurrent calls without spamming the gateway with requests.
.. _v1p5p0p3:
v1.5.0.3
--------
Bug Fixes
~~~~~~~~~~~
- Fix :attr:`TextChannel.can_send` to use proper checks
.. _vp1p5p0p2:
v1.5.0.2
--------
New Features
~~~~~~~~~~~~~~
- Add :attr:`Guild.try_member`
- Add :attr:`TextChannel.can_send`
.. _vp1p5p0p1:
v1.5.0.1
--------
New Features
~~~~~~~~~~~~~~
- Changed :attr:`Guild.icon_url` and :attr:`User.avatar_url` to return a string of the url in stead of an :class:`Asset`
- Documentation uses `Neo Docs by Rapptz <Rapptz/discord.py/tree/neo-docs>`_
- Add 1000+ colors from `ext colors <https://github.com/MGardne8/DiscordPyColours>`_
- Add support for ``hex()`` to :class:`Colour`
- Add :attr:`Guild.bots`
- Add :attr:`Guild.humans`
- |commands| Add :attr:`Bot.owner <ext.commands.Bot>`
- |commands| Add :attr:`Bot.owners <ext.commands.Bot>`
- Add :attr:`Guild.humans`
- Add :meth:`Client.try_user`
- Add :attr:`Client.embed_color`
- Add :meth:`Client.set_embed_color`
- Add :meth:`Intents.from_list`
- Add ``str()`` support to :class:`Message` which will return the :attr:`Message.content`
- Add ``int()`` support to :class:`User`, :class:`Member`, :class:`Emoji`, :class:`Role`, :class:`Guild`, :class:`Message`, :class:`TextChannel`, :class:`VoiceChannel`, :class:`CategoryChannel`, :class:`Attachment` and :class:`Message`. This will return the ID of the object
.. _vp1p5p0: .. _vp1p5p0:
v1.5.0 v1.5.0

View File

@ -1 +1 @@
aiohttp>=3.6.0,<3.8.0 aiohttp>=3.6.0,<3.7.0

View File

@ -42,12 +42,12 @@ extras_require = {
] ]
} }
setup(name='discord.py', setup(name='enhanced-dpy',
author='Rapptz', author='iDutchy',
url='https://github.com/Rapptz/discord.py', url='https://github.com/iDutchy/discord.py',
project_urls={ project_urls={
"Documentation": "https://discordpy.readthedocs.io/en/latest/", "Documentation": "https://enhanced-dpy.readthedocs.io/en/latest/",
"Issue tracker": "https://github.com/Rapptz/discord.py/issues", "Issue tracker": "https://github.com/iDutchy/discord.py/issues",
}, },
version=version, version=version,
packages=['discord', 'discord.types', 'discord.ext.commands', 'discord.ext.tasks'], packages=['discord', 'discord.types', 'discord.ext.commands', 'discord.ext.tasks'],