@@ -18,14 +18,15 @@ pip install discord-webhook
18
18
* [ Basic Webhook] ( #basic-webhook )
19
19
* [ Create Multiple Instances / Use multiple URLs] ( #create-multiple-instances )
20
20
* [ Get Webhook by ID] ( #get-webhook-by-id )
21
- * [ Send Webhook to thread] ( #send-webhook-to-thread )
21
+ * [ Send Webhook to a thread] ( #send-webhook-to-a -thread )
22
22
* [ Manage Being Rate Limited] ( #manage-being-rate-limited )
23
23
* [ Embedded Content] ( #webhook-with-embedded-content )
24
24
* [ Edit Webhook Message] ( #edit-webhook-messages )
25
25
* [ Delete Webhook Message] ( #delete-webhook-messages )
26
26
* [ Send Files] ( #send-files )
27
27
* [ Remove Embeds and Files] ( #remove-embeds-and-files )
28
28
* [ Allowed Mentions] ( #allowed-mentions )
29
+ * [ Use Message Flags] ( #use-message-flags )
29
30
* [ Use Proxies] ( #use-proxies )
30
31
* [ Timeout] ( #timeout )
31
32
* [ Async Support] ( #async-support )
@@ -62,7 +63,7 @@ webhook = DiscordWebhook(url="your webhook url", id="your webhook message id")
62
63
# now you could delete or edit the webhook
63
64
# ...
64
65
````
65
- ### Send Webhook to thread
66
+ ### Send Webhook to a thread
66
67
You can send a message to an existing thread by setting ` thread_id ` or create a new thread in a forum channel by using a ` thread_name ` .
67
68
``` python
68
69
from discord_webhook import DiscordWebhook
@@ -294,7 +295,7 @@ response = webhook.execute()
294
295
295
296
### Allowed Mentions
296
297
297
- Look into the [ Discord Docs] ( https://discord.com/developers/docs/resources/channel#allowed-mentions-object ) for examples and for more explanation
298
+ Look into the [ Discord Docs] ( https://discord.com/developers/docs/resources/channel#allowed-mentions-object ) for examples and for more explanation.
298
299
299
300
This example would only ping user ` 123 ` and ` 124 ` but not everyone else.
300
301
@@ -311,6 +312,28 @@ webhook = DiscordWebhook(url="your webhook url", content=content, allowed_mentio
311
312
response = webhook.execute()
312
313
```
313
314
315
+ ### Use Message Flags
316
+
317
+ Flags can also be set for messages. Only two are currently supported.
318
+
319
+ ``` python
320
+ from discord_webhook import DiscordEmbed, DiscordWebhook
321
+ from discord_webhook.constants import MessageFlags
322
+
323
+ content = " Hi."
324
+
325
+ # this message will not trigger push and desktop notifications
326
+ webhook = DiscordWebhook(url = " your webhook url" , content = content, flags = MessageFlags.SUPPRESS_NOTIFICATIONS .value)
327
+ response = webhook.execute()
328
+
329
+ # do not include any embeds when serializing this message
330
+ webhook = DiscordWebhook(url = " your webhook url" , content = content, flags = MessageFlags.SUPPRESS_EMBEDS .value)
331
+ embed = DiscordEmbed(title = " Your Title" , description = " Lorem ipsum dolor sit" , color = " 03b2f8" )
332
+ webhook.add_embed(embed)
333
+ # even if an embed has been added, it will not appear in the message.
334
+ response = webhook.execute()
335
+ ```
336
+
314
337
### Use Proxies
315
338
316
339
``` python
0 commit comments