What are all the contents I can add to a Discord webhook? - discord

I am making a discord webhook, and I want to know all the different things I can add to it.
As far as styling it goes; I only have a color and a message. (My code is not included besides that, just the code for the color and the message)
.setTitle('Biscuit AIO Cooked!')
.setColor('#84e1f4');
If anyone can link me a site or reply to me with all of the things I can add to the webhook, please do so :)

Read about message embeds and embed visualizer.
At last one of the features of a webhook is that you can send several embeds at once message. So code will looks like this.
{
"content": "this `supports` __a__ **subset** *of* ~~markdown~~ 😃 ```js\nfunction foo(bar) {\n console.log(bar);\n}\n\nfoo(1);```",
"embeds": [
{
"title": "title ~~(did you know you can have markdown here too?)~~",
"description": "this supports [named links](https://discordapp.com) on top of the previously shown subset of markdown. ```\nyes, even code blocks```",
"url": "https://discordapp.com",
"color": 11038012,
"timestamp": "2020-07-03T15:05:41.392Z",
"footer": {
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png",
"text": "footer text"
},
"thumbnail": {
"url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"image": {
"url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"author": {
"name": "author name",
"url": "https://discordapp.com",
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"fields": [
{
"name": "🤔",
"value": "some of these properties have certain limits..."
},
{
"name": "😱",
"value": "try exceeding some of them!"
},
{
"name": "🙄",
"value": "an informative error should show up, and this view will remain as-is until all issues are fixed"
},
{
"name": "<:thonkang:219069250692841473>",
"value": "these last two",
"inline": true
},
{
"name": "<:thonkang:219069250692841473>",
"value": "are inline fields",
"inline": true
}
]
},
{
"title": "title ~~(did you know you can have markdown here too?)~~",
"description": "this supports [named links](https://discordapp.com) on top of the previously shown subset of markdown. ```\nyes, even code blocks```",
"url": "https://discordapp.com",
"color": 11038012,
"timestamp": "2020-07-03T15:05:41.392Z",
"footer": {
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png",
"text": "footer text"
},
"thumbnail": {
"url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"image": {
"url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"author": {
"name": "author name",
"url": "https://discordapp.com",
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"fields": [
{
"name": "🤔",
"value": "some of these properties have certain limits..."
},
{
"name": "😱",
"value": "try exceeding some of them!"
},
{
"name": "🙄",
"value": "an informative error should show up, and this view will remain as-is until all issues are fixed"
},
{
"name": "<:thonkang:219069250692841473>",
"value": "these last two",
"inline": true
},
{
"name": "<:thonkang:219069250692841473>",
"value": "are inline fields",
"inline": true
}
]
}
]
}

Related

I want to add gif to Discord Ticket Bot's message

{
"embeds": {
"openTicket": {
"title": "Open a support ticket",
"description": "Click on the button to start opening a ticket",
"footer": {
"text": "test"
}
},
"ticketOpened": {
"title": "Ticket CATEGORYNAME",
"description": "A staff will reply you as soon as possible!",
"footer": {
"text": "test"
}
},
"ticketClosed": {
"title": "Ticket closed",
"description": "test"
},
"ticketClosedDM": {
"title": "Ticket closed",
"description": "test",
"footer": {
"text": "test"
}
I tried to do it this way, but it didn't happen
"img": "imgurl"`

Complete documentation on Discord embeds

I have now been searching for a good and reliable source of documentation about the Discord embed-system, but couldnt find any. I am of course aware about the offical documentation on discord.js.org and discordjs.guide, but they lack support and explanation of the embed-object that discord supports. To describe my problem precisely, I have been trying to add a button to a discord embed-object. What I have right now is this basic template for testing purposes:
const embed = {
"title": "Hello ~~people~~ world :wave:",
"description": "You can use [links](https://discord.com) or emojis :smile: 😎\n```\nAnd also code blocks\n```",
"color": 4321431,
"timestamp": "2022-07-03T18:07:18.372Z",
"url": "https://discord.com",
"author": {
"name": "Author name",
"url": "https://discord.com",
"icon_url": "https://unsplash.it/100"
},
"thumbnail": {
"url": "https://unsplash.it/200"
},
"image": {
"url": "https://unsplash.it/380/200"
},
"footer": {
"text": "Footer text",
"icon_url": "https://unsplash.it/100"
},
"fields": [
{
"name": "Field 1, *lorem* **ipsum**, ~~dolor~~",
"value": "Field value"
},
{
"name": "Field 2",
"value": "You can use custom emojis <:Kekwlaugh:722088222766923847>. <:GangstaBlob:742256196295065661>",
"inline": false
},
{
"name": "Inline field",
"value": "Fields can be inline",
"inline": true
},
{
"name": "Inline field",
"value": "*Lorem ipsum*",
"inline": true
},
{
"name": "Inline field",
"value": "value",
"inline": true
},
{
"name": "Another field",
"value": "> Nope, didn't forget about this",
"inline": false
}
]
}
I have only been able to find documentation about the internal commands of dicord.js, that use the ".set("Value")" syntax to add buttons and dropdowns to the embed.
It would be really helpful, if someone could provide me a link to a nice and detailed documentation that would ideally include all available "subcommands" for an embed object.
Any other kind of help is also very much appreciated!
Thanks a lot! :)
There is an official documentation about messages in discord developer docs, here is the documentation that you need https://discord.com/developers/docs/interactions/message-components

Example Discord slash command with choices

I need to create a Discord slash command with fixed choices for input options.
My command is /tip {token_name}
What would the JSON request look like?
please see the Slash Commands section of the Discord Documentation.
The example provided in the documentation is below. The choices array is used to set choices.
{
"name": "blep",
"type": 1,
"description": "Send a random adorable animal photo",
"options": [
{
"name": "animal",
"description": "The type of animal",
"type": 3,
"required": true,
"choices": [
{
"name": "Dog",
"value": "animal_dog"
},
{
"name": "Cat",
"value": "animal_cat"
},
{
"name": "Penguin",
"value": "animal_penguin"
}
]
},
{
"name": "only_smol",
"description": "Whether to show only baby animals",
"type": 5,
"required": false
}
]
}

Sorting arrays in Mongo

H have json document with array. As I can't add to beginning of array with push or addtoset I need to sort array. Example
{
"Component": [
{
"Id": "PDP-1",
"Links": {"Link": [
{
"Text": "Western Division",
"Url": "/1x7-en70ai/last-minute-holidays-western-division",
"Title": "Last minute holidays Western Division"
},
{
"Text": "Browse Regions ",
"Url": "/1x7-en6uly-10ts/last-minute-holidays-gambia/regions",
"Title": "Last minute holidays Gambia",
"Style": "BrowseForMore"
},
{
"Text": "City of Banjul",
"Url": "/1x6-en6vq7/holidays-city-of-banjul",
"Title": "City of Banjul Holidays"
},
{
"Text": "Western Division",
"Url": "/1x6-en70ai/holidays-western-division",
"Title": "Western Division Holidays"
}
]},
"Title": "Regions",
"Type": "PDP"
},
{
"Id": "PDP-2",
"Links": {"Link": [
{
"Text": "Bijilo",
"Url": "/1x7-enbmy6/last-minute-holidays-bijilo",
"Title": "Last minute holidays Bijilo"
},
{
"Text": "Browse Cities ",
"Url": "/1x7-en6uly-10tt/last-minute-holidays-gambia/cities",
"Title": "Last minute holidays Gambia",
"Style": "BrowseForMore"
},
{
"Text": "Banjul Beach",
"Url": "/1x6-enakgm/holidays-banjul-beach",
"Title": "Banjul Beach Holidays"
},
{
"Text": "Bijilo",
"Url": "/1x6-enbmy6/holidays-bijilo",
"Title": "Bijilo Holidays"
},
{
"Text": "Brufut Heights",
"Url": "/1x6-encok8/holidays-brufut-heights",
"Title": "Brufut Heights Holidays"
},
{
"Text": "Kololi",
"Url": "/1x6-enpnle/holidays-kololi",
"Title": "Kololi Holidays"
},
{
"Text": "Kotu",
"Url": "/1x6-enq067/holidays-kotu",
"Title": "Kotu Holidays"
}
]},
"Title": "Cities",
"Type": "PDP"
}
],
"Id": "118431",
"Template": {
"PageTemplate": {
"Code": "2B2",
"text": "041 - TEMP2 - COP_CONCOU_{LAST MINUTE}"
},
"Category": {
"Code": "1X7",
"Type": "Product",
"text": "Last minute holidays"
},
"GeoObject": {
"Code": "EN6ULY",
"text": "Gambia, The"
},
"GeoObjectType": {
"Code": "1A",
"text": "Political"
},
"GeoObjectSubType": {
"Code": "10TR",
"text": "Country"
}
},
"Type": "Content",
"Url": "/1x7-en6uly/last-minute-holidays-gambia",
"_id": {"$oid": "528492d4c90fa9fcd0436929"}
}
I want to sort this by Style in Links.Link 'BrowseForMore'. Any idea how to do it? I thought I could add dummy array with push which could then sort it the way I want. Any help appreciated
You appear to want to update the array and keep the sort order with your Links.Link.Style value at the front of the list. In which case use the $sort modifier with update.
db.collection.update(
{ _id: id },
{ $push: { "Links.Link: {$each: [doc], $sort { Style: -1 }}} }
)
The $each operator is required even if there is only one document, but can take many.
if you are trying to use $addToSet to maintain unique documents the official MongoDB line is that sets are considered to be unordered and hence the modifiers are not available here.

Background images not appearing in cards anymore

My app was functioning fine until sometime last week. For some reason all the background images stopped appearing in the actual Google Glass. They do appear in the playgorund. Anyone know how to fix this? Here's an example of my app home card (I changed the URLs). The home.jpg image does not appear.
{
"kind": "mirror#timelineItem",
"id": "a48a9a6a-67df-4035-859f-b33f05c4e11e",
"created": "2013-06-14T16:24:17.460Z",
"updated": "2013-06-14T16:24:17.460Z",
"etag": "\"r3ghbVW9Rp1kDP4UexS05_pFx4E/gCTDXyXBhsaPhUc6MnVaYblah\"",
"html": "<article class=\"photo\">\t<img src=\"https://myapp.appspot.com/static/images/home.jpg?cacheKiller=098234092384\" width=\"100%\" height=\"100%\">\t<div class=\"photo-overlay\"></div>\t<section>\t\t<p class=\"text-auto-size\"></p>\t</section></article>",
"menuItems": [
{
"id": "menu1",
"action": "CUSTOM",
"values": [
{
"displayName": "Menu 1",
"iconUrl": "https://myapp.appspot.com/static/images/icon.png?cacheKiller=098234092384"
}
]
},
{
"id": "menu2",
"action": "CUSTOM",
"values": [
{
"displayName": "Menu 2",
"iconUrl": "https://myapp.appspot.com/static/images/icon.png?cacheKiller=098234092384"
}
]
},
{
"id": "menu3",
"action": "CUSTOM",
"values": [
{
"displayName": "Menu 3",
"iconUrl": "https://myapp.appspot.com/static/images/icon.png?cacheKiller=098234092384"
}
]
},
{
"id": "menu4",
"action": "CUSTOM",
"values": [
{
"displayName": "Menu 4",
"iconUrl": "https://myapp.appspot.com/static/images/icon.png?cacheKiller=098234092384"
}
]
},
{
"id": "pinned",
"action": "TOGGLE_PINNED"
}
],
"notification": {
"level": "DEFAULT"
}
}
This appears to be a more widespread problem, possibly since the introduction of XE6. In many of the cases, the background image will show up later.
Since you have some concrete examples of this, I suggest you open a bug in the issue tracker.
An update was made and issue corrected. Just need to soft reset (hold down for 15 seconds) and be connected to data.
The issue was css related for photos. It did not effect videos.

Resources