|
1 | 1 | # $authorAvatar |
2 | 2 |
|
3 | | -This function returns the URL of the avatar for the user who triggered the command. |
4 | | - |
5 | | -::: tip Important Considerations |
6 | | -Discord automatically embeds images when a link to an image is included in a message. See the examples below to understand the different ways Discord handles image links. |
7 | | -- If a message contains *only* a link to an image, Discord sends only the image embed. |
8 | | -- If a message contains a link to an image *and* additional text, Discord sends both the link and the image embed. |
9 | | - |
10 | | -To send the image as an attachment *without* displaying the link, use the [$attachment](../Text/Embed/attachment.md) function. |
11 | | - |
12 | | -To display the avatar URL as plain text (without embedding the image), enclose the function in backticks: `` `$authorAvatar` ``. |
13 | | -::: |
| 3 | +Returns the avatar (profile picture) URL of the user who executed the command. |
14 | 4 |
|
15 | 5 | ## Usage |
16 | 6 |
|
17 | 7 | ```bash |
18 | | -$authorAvatar[Return Server Avatar Instead (yes/no, default is no)] |
| 8 | +$authorAvatar[serverAvatar] |
19 | 9 | ``` |
20 | | - |
21 | | -## Arguments |
22 | | - |
23 | | -* `Return Server Avatar Instead (yes/no, default is no)`: An optional argument. If set to `yes`, the function will return the user's server avatar (if they have one) instead of their global avatar. Defaults to `no`. |
| 10 | +1. **serverAvatar** - (Optional) default value: `no`. Can be `yes` or `no`. Discord does have two types of avatars, global and per-server (custom avatar in each server). If no server avatar is set, the global avatar will be used. |
24 | 11 |
|
25 | 12 | ## Examples |
26 | 13 |
|
27 | | -### Sending the Avatar URL with Text |
| 14 | +#### Sending avatar URL |
28 | 15 |
|
29 | | -This example demonstrates how the avatar URL is displayed when sent with accompanying text. |
| 16 | +How is the avatar URL displayed when sent with text and without text |
30 | 17 |
|
31 | 18 | <discord-messages> |
32 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
33 | | - !!exec My avatar link: $authorAvatar<br/> |
34 | | - Image attached below: |
35 | | - </discord-message> |
36 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
37 | | - My avatar link: |
38 | | - <a href="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"> |
39 | | - https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096 |
40 | | - </a><br/> |
41 | | - Image attached below: |
42 | | - <DiscordReaction image="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"></DiscordReaction> |
| 19 | + <discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png"> |
| 20 | + !!exec With text: $authorAvatar |
43 | 21 | </discord-message> |
44 | | -</discord-messages> |
45 | | - |
46 | | -### Sending Only the Avatar URL |
47 | | - |
48 | | -This example demonstrates how the avatar is embedded when *only* the avatar URL is sent in the message. |
49 | | - |
50 | | -::: details Example |
51 | | -<discord-messages> |
52 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
| 22 | + <discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png"> |
| 23 | + With text: <a href="https://cdn.discordapp.com/embed/avatars/0.png"> |
| 24 | + https://cdn.discordapp.com/embed/avatars/0.png |
| 25 | + </a><br> |
| 26 | + <img src="https://cdn.discordapp.com/embed/avatars/0.png" alt="User Avatar" style="vertical-align: text-bottom;" /> |
| 27 | + </discord-message> |
| 28 | + <discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png"> |
53 | 29 | !!exec $authorAvatar |
54 | 30 | </discord-message> |
55 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
56 | | - <DiscordReaction image="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"></DiscordReaction> |
| 31 | + <discord-message :bot="true" role-color="#5fb0fa" author="Custom Command" avatar="https://doc.ccommandbot.com/bot-profile.png"> |
| 32 | + <img src="https://cdn.discordapp.com/embed/avatars/0.png" alt="User Avatar" style="vertical-align: text-bottom;" /> |
57 | 33 | </discord-message> |
58 | 34 | </discord-messages> |
59 | | -::: |
60 | | - |
61 | | -### Sending the Avatar as an Attachment (Without the Link) |
62 | | - |
63 | | -This example demonstrates how to send the avatar as an attachment *without* including the direct link in the message. This is achieved using the `$attachment` function. |
64 | 35 |
|
65 | | -::: details Example |
66 | | -<discord-messages> |
67 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
68 | | - !!exec No link, only text and image<br/> |
69 | | - $attachment[$authorAvatar] |
70 | | - </discord-message> |
71 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
72 | | - No link, only text and image |
73 | | - <DiscordReaction image="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"></DiscordReaction> |
74 | | - </discord-message> |
75 | | -</discord-messages> |
| 36 | +::: tip Note |
| 37 | +You can send the image as an attachment, so no link will be displayed. For this, you can use function [$attachment](../Text/Embed/attachment.md). |
| 38 | +To display the avatar URL as plain text, either enclose the function in backticks (`` `$authorAvatar` ``) or angle brackets (`<$authorAvatar>`). |
76 | 39 | ::: |
77 | 40 |
|
78 | | -### Sending the Avatar URL as Plain Text |
79 | | - |
80 | | -This example demonstrates how to display the avatar URL as plain text instead of embedding the image. This is done by wrapping the function call in backticks. |
| 41 | +##### Related functions: [$attachment](../Text/Embed/attachment.md) |
81 | 42 |
|
82 | | -::: details Example |
83 | | -<discord-messages> |
84 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
85 | | - !!exec <DiscordMarkdown>`$authorAvatar`</DiscordMarkdown><br/> |
86 | | - </discord-message> |
87 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
88 | | - <DiscordMarkdown> |
89 | | - `https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096` |
90 | | - </DiscordMarkdown> |
91 | | - </discord-message> |
92 | | -</discord-messages> |
93 | | -::: |
| 43 | +##### Function difficulty: <Badge type="tip" text="Easy" vertical="middle"/> |
| 44 | +###### Tags: <Badge type="tip" text="Image" vertical="middle"/> <Badge type="tip" text="Avatar" vertical="middle"/> <Badge type="tip" text="Attachment" vertical="middle"/> <Badge type="tip" text="profile picture" vertical="middle"/> |
0 commit comments