284 Commits

Author SHA1 Message Date
Stocker
5aa696ccfa
Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
chromacoat dreamkey
095aaa9ad1
Change wording of InvalidArgument removal in docs 2022-03-11 23:25:43 -05:00
Eric Schneider
ef92170a9d
Fix Message.edit ignoring suppress kwarg 2022-03-10 18:56:42 -05:00
Stocker
e15415413b
Add missing parameters to certain methods
- slowmode_delay and reason in Message.create_thread
- slowmode_delay in TextChannel.create_thread
- reason in Guild.edit_widget
2022-03-06 23:00:50 -05:00
Stocker
12d4de52a8
Add Attachment.ephemeral 2022-03-06 22:59:15 -05:00
m-etroo
e3de172ba9
Fix incorrect wording in Message.edit docstring
'role' -> 'message'
2022-03-06 19:04:52 -05:00
Josh
147948af9b
Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
Josh
2b69b5d545
Remove discord.InvalidArgument
This uses TypeError and ValueError instead.
2022-02-26 01:44:49 -05:00
Rapptz
8d52ddaff6 Fix remaining type errors in main package
This doesn't fix the type errors in the ext packages though.
2022-02-22 04:19:46 -05:00
Nadir Chowdhury
3cf000d467
Type up gateway payloads 2022-02-21 22:09:40 -05:00
Rapptz
f2600995e8 Fix NameError due to missing import 2022-02-20 11:04:50 -05:00
Rapptz
88b520b5ab Reformat code using black
Segments where readability was hampered were fixed by appropriate
format skipping directives. New code should hopefully be black
compatible. The moment they remove the -S option is probably the moment
I stop using black though.
2022-02-20 08:04:58 -05:00
jack1142
686f233954
Add missing information about in-place edits in Message.edit 2022-02-19 22:35:52 -05:00
Josh
dede5539ee
Add support for editing message attachments 2022-02-19 22:02:53 -05:00
jack1142
dc19c6c7d5
Add positional-only arguments in more places 2022-02-19 20:28:01 -05:00
Alex Nørgaard
2e5da07180
Fix unknown DMChannel in MessageReference.resolved.channel
Threads would cause the message reference to resolve to a DMChannel
2022-02-18 20:26:13 -05:00
Josh
ce01033e06
Allow PartialMessage.channel to be a PartialMessageable 2022-02-18 08:31:07 -05:00
Rapptz
770a5fee9c Remove PartialMessage.edit duplicated code
Now that Message.edit returns the message this duplication is no longer
needed.
2022-02-18 07:48:43 -05:00
Rapptz
9c066a8cf6 Refactor internal message sending and editing parameter passing
This reduces some repetition in many functions and is ripped out of
the webhook code. This also removes the unused HTTP functions for
interaction responses since those belong in the webhook code rather
than the HTTPClient.
2022-02-18 07:47:59 -05:00
Josh
08bee0eeb6
Add support for file/attachment descriptions 2022-02-18 05:23:02 -05:00
James Gayfer
4aafa39e8c
Update thread permissions
Discord has renamed / repurposed "Use Public Threads" and "Use Private
Threads", as well as added a new permission "Send Messages in Threads".

For more information, see:
  https://github.com/discord/discord-api-docs/pull/3672
2021-08-26 15:53:21 -04:00
Rapptz
8306b9f6af Add type hint for suppress parameter 2021-08-23 23:51:40 -04:00
Rapptz
490bbffc93 Remove in-place edits and return fresh instances instead
Fixes #4098
2021-08-23 23:46:50 -04:00
Rapptz
8bbb8f6db9 Use getattr for default_auto_archive_duration in Message.create_thread
Some channel types do not have this attribute so a fallback is
necessary to prevent the attribute access from erroring.
2021-08-23 23:44:20 -04:00
Stocker
d8b06ca7f2
Fix message.py typehints 2021-08-23 23:43:57 -04:00
James Gayfer
489e5f3288
Use channel default auto archive duration
Currently creating a new thread uses a default auto archive duration of
1440 minutes, or 1 day.

Rather than prescribing our own default, we can use the default auto
archive duration that is set on the channel. This ensures that newly
created threads will respect the default auto archive duration as
prescribed by the user.
2021-08-18 05:12:40 -04:00
Rapptz
3b4c6269be Fix documentation for Message.is_system
Also fixes some formatting
2021-08-18 01:01:24 -04:00
AkshuAgarwal
6b6bcb92e6
Fix missing or broken versionadded in docstrings
This also documents BadFlagArgument.flag
2021-08-18 00:45:02 -04:00
SYCKGit
f7a3ea90b8
Add other message types exclusions to Message.is_system
Message.is_system was checking if self.type is MessageType.default
but now there are other MessageTypes that are not system messages
2021-08-18 00:42:48 -04:00
Rapptz
1e17b7fcea Rename start_thread to create_thread for consistency 2021-08-12 00:30:50 -04:00
Rapptz
1279510194 Add support for PartialMessageable instances
This allows library users to send messages to channels without fetching
it first.
2021-08-10 09:24:49 -04:00
Nadir Chowdhury
60d82cf908
implement guild stickers 2021-07-30 21:25:41 -04:00
Rapptz
dac0267e28 Allow creating a public thread without a starter message 2021-07-28 23:50:02 -04:00
nickofolas
0112c2819f
Fix PartialMessage rejecting Threads 2021-07-28 20:00:43 -04:00
Lilly Rose Berner
a053f77275
Add system_content for thread message types, fix other system_content issues 2021-07-28 20:00:14 -04:00
Nadir Chowdhury
e2624b9a31
[commands] Fix (Partial)MessageConverter to work with thread messages 2021-07-10 03:11:34 -04:00
Alex Nørgaard
d1dc41ec2f
Fix Client.fetch_channel not returning Thread 2021-07-03 21:35:31 -04:00
Rapptz
8b4dd34328 Document TextChannel.start_thread return type 2021-07-03 11:52:20 -04:00
Rapptz
3d0dd5bc1b Change Message.__repr__ to show inherited type name 2021-07-03 11:02:32 -04:00
Josh
d001b9d0ee
[docs] Fix more references
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-07-01 07:48:37 -04:00
Rapptz
1aeec34f84 Typehint Member and various typing fixes 2021-06-30 01:28:35 -04:00
Rapptz
44d1d29708 Add explicit types to variables in Message types 2021-06-29 23:56:02 -04:00
Lilly Rose Berner
6b1d46a1ea
Set Message.guild from guild_id if unavailable through Message.channel 2021-06-28 19:03:59 -04:00
Rapptz
b1836c5577 Rework Message.edit implementation 2021-06-28 00:33:59 -04:00
Aomi Vel
47e6a754e4
Add support for sending multiple embeds 2021-06-27 23:52:48 -04:00
Rapptz
b2176dc0ef Change how threads are created
Instead of start_public_thread and start_private_thread they'll now be
one method.

I might revert this if starting a public thread without a message never
ends up happening.
2021-06-08 07:26:22 -04:00
Rapptz
ac95b8b85b Allow Message.channel to be a thread 2021-06-08 07:25:40 -04:00
Rapptz
c1ce3b949f Implement remaining HTTP endpoints on threads
I'm not sure if I missed any -- but this is the entire documented set
so far.
2021-06-08 07:25:30 -04:00
Lilly Rose Berner
fb0c6c56e1
Return message content for replies in Message.system_content 2021-06-06 17:31:32 -04:00
Rapptz
d0097c4281 Remove view syncing before editing in views
This prevents a potential race condition when a MESSAGE_UPDATE is
received syncing and refreshing the view components causing a desync.
2021-05-31 05:50:40 -04:00