commit f09340c

default  ·  2023-08-14 11:12:16 +0000 UTC
parent 1d61530
If a user 'header' field is defined, use it.
1 files changed,  +10, -0
+10, -0
 1@@ -955,6 +955,16 @@ xs_dict *msg_actor(snac *snac)
 2     if (xs_type(xs_dict_get(snac->config, "bot")) == XSTYPE_TRUE)
 3         msg = xs_dict_set(msg, "type", "Service");
 4 
 5+    /* add the header image, if there is one defined */
 6+    const char *header = xs_dict_get(snac->config, "header");
 7+    if (!xs_is_null(header)) {
 8+        xs *d = xs_dict_new();
 9+        d = xs_dict_append(d, "type",       "Image");
10+        d = xs_dict_append(d, "mediaType",  xs_mime_by_ext(header));
11+        d = xs_dict_append(d, "url",        header);
12+        msg = xs_dict_set(msg, "image", d);
13+    }
14+
15     return msg;
16 }
17