|
1 | 1 | # $authorAvatar |
2 | 2 |
|
3 | | -Returns the URL to the User's avatar that triggered the command. |
4 | | - |
5 | | -::: tip Discord adds image to message if link provided <Badge type="tip" text="Read examples section" vertical="middle"/> |
6 | | -If a message contains only a link to an image, Discord sends **only** the image. |
7 | | - |
8 | | -If a message has a link to an image AND some text, Discord sends **both** the link and the image. |
9 | | - |
10 | | -To add image without posting the link use [$attachment](../Text/Embed/attachment.md) |
11 | | - |
12 | | -To send link as a plain text wrap the function into graves like<code>\`$authorAvatar\`</code> |
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 | ``` |
| 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. |
20 | 11 |
|
21 | 12 | ## Examples |
22 | 13 |
|
23 | | -### Message contains text and link to image |
| 14 | +#### Sending avatar URL |
24 | 15 |
|
25 | | -<discord-messages> |
26 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
27 | | - !!exec My avatar link: $authorAvatar<br/> |
28 | | - Image attached below: |
29 | | - </discord-message> |
30 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
31 | | - My avatar link: |
32 | | - <a href="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"> |
33 | | - https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096 |
34 | | - </a><br/> |
35 | | - Image attached below: |
36 | | - <DiscordReaction image="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"></DiscordReaction> |
37 | | - </discord-message> |
38 | | -</discord-messages> |
39 | | - |
40 | | -### Message contains only link to image |
| 16 | +How is the avatar URL displayed when sent with text and without text |
41 | 17 |
|
42 | | -::: details Example |
43 | 18 | <discord-messages> |
44 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
45 | | - !!exec $authorAvatar |
| 19 | + <discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png"> |
| 20 | + !!exec With text: $authorAvatar |
46 | 21 | </discord-message> |
47 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
48 | | - <DiscordReaction image="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096"></DiscordReaction> |
| 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;" /> |
49 | 27 | </discord-message> |
50 | | -</discord-messages> |
51 | | -::: |
52 | | - |
53 | | -### Send text and image without link |
54 | | - |
55 | | -::: details Example |
56 | | -<discord-messages> |
57 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
58 | | - !!exec No link, only text and image<br/> |
59 | | - $attachment[$authorAvatar] |
| 28 | + <discord-message :bot="false" role-color="#d6e0ff" author="User" avatar="https://cdn.discordapp.com/embed/avatars/0.png"> |
| 29 | + !!exec $authorAvatar |
60 | 30 | </discord-message> |
61 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
62 | | - No link, only text and image |
63 | | - <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;" /> |
64 | 33 | </discord-message> |
65 | 34 | </discord-messages> |
| 35 | + |
| 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>`). |
66 | 39 | ::: |
67 | 40 |
|
68 | | -### Send link as plain text |
| 41 | +##### Related functions: [$attachment](../Text/Embed/attachment.md) |
69 | 42 |
|
70 | | -::: details Example |
71 | | -<discord-messages> |
72 | | - <discord-message :bot="false" role-color="#ffcc9a" author="crochet" avatar="https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096" > |
73 | | - !!exec <DiscordMarkdown>`$authorAvatar`</DiscordMarkdown><br/> |
74 | | - </discord-message> |
75 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp" > |
76 | | - <DiscordMarkdown> |
77 | | - `https://cdn.discordapp.com/avatars/808007806266769458/768de61c5d90024e100ec5c058d3c2fe.webp?size=4096` |
78 | | - </DiscordMarkdown> |
79 | | - </discord-message> |
80 | | -</discord-messages> |
81 | | -::: |
| 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