Google Document commands standard - google-docs

I wrote some text in google doc offline and it fails to sync it.
Inspecting requests I found that it tries to do the sync process with a post request containing actions I've done while offline.
It's something like this:
{'commands': [{'ibi': 14223, 's': ' ', 'ty': 'is'}, {'ibi': 14224, 's': ' ', 'ty': 'is'}, {'ibi': 14225, 's': ' ', 'ty': 'is'}, {'ibi': 14226, 's': ' ', 'ty': 'is'}, {'ibi': 14227, 's': ' ', 'ty': 'is'}, {'si': 14228, 'ei': 14261, 'ty': 'ds'}, {'si': 14227, 'ei': 14227, 'ty': 'ds'}, {'si': 14226, 'ei': 14226, 'ty': 'ds'}, {'si': 14225, 'ei': 14225, 'ty': 'ds'}, {'si': 14224, 'ei': 14224, 'ty': 'ds'}, {'si': 14223, 'ei': 14223, 'ty': 'ds'}, {'si': 14222, 'ei': 14222, 'ty': 'ds'}, {'mts': [{'ibi': 14222, 's': ' ', 'ty': 'is'}, {'si': 14222, 'st': 'text', 'ei': 14222, 'sm': {'ts_it_i': True, 'ts_st_i': True, 'ts_fgc_i': True, 'ts_bd_i': True, 'ts_fs_i': True, 'ts_un_i': True, 'ts_ff_i': True, 'ts_va_i': True, 'ts_bgc_i': True, 'ts_sc_i': True}, 'ty': 'as'}], 'ty': 'mlti'}, {'ibi': 14223, 's': ';', 'ty': 'is'}, {'si': 14223, 'ei': 14223, 'ty': 'ds'}, {'mts': [{'ibi': 14223, 's': 'ک', 'ty': 'is'}, {'si': 14223, 'st': 'text', 'ei': 14223, 'sm': {'ts_it_i': True, 'ts_st_i': True, 'ts_fgc_i': True, 'ts_bd_i': True, 'ts_fs_i': True, 'ts_un_i': True, 'ts_ff_i': True, 'ts_va_i': True, 'ts_bgc_i': True, 'ts_sc_i': True}, 'ty': 'as'}], 'ty': 'mlti'}, {'ibi': 14224, 's': 'ه', 'ty': 'is'}, {'ibi': 14225, 's': ' ', 'ty': 'is'}, {'ibi': 14226, 's': 'ر', 'ty': 'is'}, {'ibi': 14227, 's': 'ف', 'ty': 'is'}, {'ibi': 14228, 's': 'ت', 'ty': 'is'}, {'ibi': 14229, 's': 'ه', 'ty': 'is'}, {'ibi': 14230, 's': ' ', 'ty': 'is'}, {'ibi': 14231, 's': 'ر', 'ty': 'is'}, {'ibi': 14232, 's': 'ف', 'ty': 'is'}, {'ibi': 14233, 's': 'ت', 'ty': 'is'}, {'ibi': 14234, 's': 'ه', 'ty': 'is'}, {'ibi': 14235, 's': ' ', 'ty': 'is'}, {'ibi': 14236, 's': 'ب', 'ty': 'is'}, {'ibi': 14237, 's': 'ع', 'ty': 'is'}, {'si': 14237, 'ei': 14237, 'ty': 'ds'}, {'mts': [{'ibi': 14237, 's': 'ه', 'ty': 'is'}, {'si': 14237, 'st': 'text', 'ei': 14237, 'sm': {'ts_it_i': True, 'ts_st_i': True, 'ts_fgc_i': True, 'ts_bd_i': True, 'ts_fs_i': True, 'ts_un_i': True, 'ts_ff_i': True, 'ts_va_i': True, 'ts_bgc_i': True, 'ts_sc_i': True}, 'ty': 'as'}], 'ty': 'mlti'}, {'ibi': 14238, 's': ' ', 'ty': 'is'}, {'ibi': 14239, 's': 'ت', 'ty': 'is'}, {'ibi': 14240, 's': 'ع', 'ty': 'is'}, {'ibi': 14241, 's': 'د', 'ty': 'is'}, {'ibi': 14242, 's': 'ا', 'ty': 'is'}, {'ibi': 14243, 's': 'د', 'ty': 'is'}, {'ibi': 14244, 's': 'ش', 'ty': 'is'}, {'ibi': 14245, 's': 'ا', 'ty': 'is'}, {'ibi': 14246, 's': 'ن', 'ty': 'is'}, {'ibi': 14247, 's': ' ', 'ty': 'is'}, {'ibi': 14248, 's': 'ا', 'ty': 'is'}, {'ibi': 14249, 's': 'ف', 'ty': 'is'}, {'ibi': 14250, 's': 'ز', 'ty': 'is'}, {'ibi': 14251, 's': 'و', 'ty': 'is'}, {'ibi': 14252, 's': 'د', 'ty': 'is'}, {'ibi': 14253, 's': 'د', 'ty': 'is'}, {'ibi': 14254, 's': 'ه', 'ty': 'is'}, {'si': 14254, 'ei': 14254, 'ty': 'ds'}, {'si': 14253, 'ei': 14253, 'ty': 'ds'}, {'mts': [{'ibi': 14253, 's': 'ه', 'ty': 'is'}, {'si': 14253, 'st': 'text', 'ei': 14253, 'sm': {'ts_it_i': True, 'ts_st_i': True, 'ts_fgc_i': True, 'ts_bd_i': True, 'ts_fs_i': True, 'ts_un_i': True, 'ts_ff_i': True, 'ts_va_i': True, 'ts_bgc_i': True, 'ts_sc_i': True}, 'ty': 'as'}], 'ty': 'mlti'}, {'ibi': 14254, 's': ' ', 'ty': 'is'}, {'ibi': 14255, 's': 'م', 'ty': 'is'}, {'ibi': 14256, 's': 'ی', 'ty': 'is'}, {'ibi': 14257, 's': '\u200c', 'ty': 'is'}, {'ibi': 14258, 's': 'ش', 'ty': 'is'}, {'ibi': 14259, 's': 'د', 'ty': 'is'}, {'ibi': 14260, 's': '.', 'ty': 'is'}], 'reqId': 0, 'sid': 'e0e19c9076fbda5'}
How can I recover my text by this commands? what's its standard? does anybody knows a program that can parse it?
Does anybody know where does google-drive-offline store these command so that I can split it into small pieces?

Related

New dict filtered by item

Could you help me with this simple stuff, unfortunately I don't get it.
I have this a list with two another lists with lists of dicts (but it can be more lists).
a = [
[
{'DESCRIP': '', 'INTF': 'Vl77', 'PROTOCOL': 'up', 'STATUS': 'up'},
{'DESCRIP': '', 'INTF': 'Fa0', 'PROTOCOL': 'down', 'STATUS': 'admin down'}
],
[
{'INBOUND_ACL': '', 'INTF': 'Vlan77', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'INBOUND_ACL': '', 'INTF': 'FastEthernet0', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]
]
My goal is to get a final list of merged dicts, derived by a rule ('merge all dicts that contain the 'INTF' field with the same number, in this case 77 or 0 , in other words to filter by interface number').
Like that
new_dict = [
{'DESCRIP': '', 'PROTOCOL': 'up', 'STATUS': 'up','INBOUND_ACL': '', 'INTF': 'Vlan77', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up','MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'DESCRIP': '', 'PROTOCOL': 'down', 'STATUS': 'admin down','INBOUND_ACL': '', 'INTF': 'FastEthernet0', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]
Since we are looking to merge dicts based on a key, I think the best place to start will be to reshape our data to facilitate a key based lookup. While we are reshaping the data, let's also create a key that is just the number.
import re
a_reshaped = [
{re.search(r'\d+', x["INTF"]): x for x in y}
for y in a
]
print(a_reshaped )
This will give us:
[
{
'77': {'DESCRIP': '', 'INTF': 'Vl77', 'PROTOCOL': 'up', 'STATUS': 'up'},
'0': {'DESCRIP': '', 'INTF': 'Fa0', 'PROTOCOL': 'down', 'STATUS': 'admin down'}
},
{
'77': {'INBOUND_ACL': '', 'INTF': 'Vlan77', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
'0': {'INBOUND_ACL': '', 'INTF': 'FastEthernet0', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
}
]
At this point we can iterate over a_reshaped and merge the dicts based on the key. We can base this part on either setdefault() or collections.defaultdict(). I prefer the second myself.
import collections
results = collections.defaultdict(dict)
for c in a_reshaped:
for key, value in c.items():
results[key] = {**results[key], **value}
print(list(results.values()))
Giving us:
[
{'DESCRIP': '', 'INTF': 'Vlan77', 'PROTOCOL': 'up', 'STATUS': 'up', 'INBOUND_ACL': '', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'DESCRIP': '', 'INTF': 'FastEthernet0', 'PROTOCOL': 'down', 'STATUS': 'admin down', 'INBOUND_ACL': '', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]
The complete solution based on collections.defaultdict() being:
import re
import collections
a = [
[
{'DESCRIP': '', 'INTF': 'Vl77', 'PROTOCOL': 'up', 'STATUS': 'up'},
{'DESCRIP': '', 'INTF': 'Fa0', 'PROTOCOL': 'down', 'STATUS': 'admin down'}
],
[
{'INBOUND_ACL': '', 'INTF': 'Vlan77', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'INBOUND_ACL': '', 'INTF': 'FastEthernet0', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]
]
a_reshaped = [
{re.search(r'\d+', x["INTF"]).group(): x for x in y}
for y in a
]
results = collections.defaultdict(dict)
for c in a_reshaped:
for key, value in c.items():
results[key] = {**results[key], **value}
print(list(results.values()))
or based on setdefault() as:
import re
a = [
[
{'DESCRIP': '', 'INTF': 'Vl77', 'PROTOCOL': 'up', 'STATUS': 'up'},
{'DESCRIP': '', 'INTF': 'Fa0', 'PROTOCOL': 'down', 'STATUS': 'admin down'}
],
[
{'INBOUND_ACL': '', 'INTF': 'Vlan77', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'INBOUND_ACL': '', 'INTF': 'FastEthernet0', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]
]
a_reshaped = [
{re.search(r'\d+', x["INTF"]).group(): x for x in y}
for y in a
]
results = {}
for c in a_reshaped:
for key, value in c.items():
results[key] = {**results.setdefault(key, {}), **value}
print(list(results.values()))
Both will give you:
[
{'DESCRIP': '', 'INTF': 'Vlan77', 'PROTOCOL': 'up', 'STATUS': 'up', 'INBOUND_ACL': '', 'IPADDR': ['192.168.77.11/24'], 'IP_HELPER': [], 'LINK_STATUS': 'up', 'MTU': '1500', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'up', 'VRF': ''},
{'DESCRIP': '', 'INTF': 'FastEthernet0', 'PROTOCOL': 'down', 'STATUS': 'admin down', 'INBOUND_ACL': '', 'IPADDR': [], 'IP_HELPER': [], 'LINK_STATUS': 'administratively down', 'MTU': '', 'OUTGOING_ACL': '', 'PROTOCOL_STATUS': 'down', 'VRF': ''}
]

Making a list of dict from a list of lists with the list[0] as keys and other lists as values

could you tell me how can I get a list of dicts from that with the a[0] as keys for each dict and a[1:] as values accordingly.
a = [['PORT', 'NAME', 'STATUS', 'VLAN', 'DUPLEX', 'SPEED', 'TYPE', 'FC_MODE'], ['Gi1/0/1', 'S1-P1-01 Cisco_Roo', 'connected', '248', 'a-full', 'a-1000', '10/100/1000BaseTX', ''], ['Gi1/0/2', '', 'notconnect', '121', 'auto', 'auto', '10/100/1000BaseTX', ''], ['Gi1/0/3', '', 'notconnect', '121', 'auto', 'auto', '10/100/1000BaseTX', '']]
I wanna get
[{'PORT' : 'Gi1/0/1',
'NAME' : 'S1-P1-01 Cisco_Roo',
.
.
.
},
{'PORT' : 'Gi1/0/2',
'NAME' : '',
.
.
.
}]
The easiest is probably:
[dict(zip(a[0], x)) for x in a[1:]]
This walks through each element from 1 onwards, and combines it with the first element, converting to a dictionary.
Does this work?
a = [
['PORT', 'NAME', 'STATUS', 'VLAN', 'DUPLEX', 'SPEED', 'TYPE', 'FC_MODE'],
['Gi1/0/1', 'S1-P1-01 Cisco_Roo', 'connected', '248', 'a-full', 'a-1000', '10/100/1000BaseTX', ''],
['Gi1/0/2', '', 'notconnect', '121', 'auto', 'auto', '10/100/1000BaseTX', ''],
['Gi1/0/3', '', 'notconnect', '121', 'auto', 'auto', '10/100/1000BaseTX', '']
]
import pandas as pd
pd.DataFrame(a[1:],columns=a[0]).to_dict(orient="records")
Creates this output.
[{'PORT': 'Gi1/0/1',
'NAME': 'S1-P1-01 Cisco_Roo',
'STATUS': 'connected',
'VLAN': '248',
'DUPLEX': 'a-full',
'SPEED': 'a-1000',
'TYPE': '10/100/1000BaseTX',
'FC_MODE': ''},
{'PORT': 'Gi1/0/2',
'NAME': '',
'STATUS': 'notconnect',
'VLAN': '121',
'DUPLEX': 'auto',
'SPEED': 'auto',
'TYPE': '10/100/1000BaseTX',
'FC_MODE': ''},
{'PORT': 'Gi1/0/3',
'NAME': '',
'STATUS': 'notconnect',
'VLAN': '121',
'DUPLEX': 'auto',
'SPEED': 'auto',
'TYPE': '10/100/1000BaseTX',
'FC_MODE': ''}]

How to get a clean result out of DynamoDB?

I'm using DynamoDB and when I use the funcion boto3.get_item() it returns me a dict like that:
{'last_updated': {'S': '2020-02-11 21:48:05'},
'id_': {'S': 'ID_DA_SURVEY'},
'deleted': {'BOOL': False},
'created': {'S': '2020-02-11 21:48:05'},
'activated': {'BOOL': False},
'step': {'S': 'editor'},
'owner': {'N': '12'},
'built': {'BOOL': False},
'name': {'S': 'Survey UM'},
'up_lime': {'BOOL': False},
'lang': {'S': 'pt'},
'teste': {'M': {'test': {'M': {'test2': {'N': '54'}}}}}
}
There is a way so I can get my Dict like that:
{'last_updated': '2020-02-11 21:48:05',
'id_': 'ID_DA_SURVEY',
'deleted': False,
'created': '2020-02-11 21:48:05',
'activated': False,
'step': 'editor',
'owner': '12',
'built': False,
'name': 'Survey UM',
'up_lime': False,
'lang': 'pt',
'teste': {'test': {'test2': '54'}}
}
I Just need to get rid of the Attribut Type. Can anyone help me?
You can use boto3 class named TypeDeserializer from the dynamodb types package.
Here's an example:
import pprint
from boto3.dynamodb.types import TypeDeserializer
item = {
'last_updated': {
'S': '2020-02-11 21:48:05'
},
'id_': {
'S': 'ID_DA_SURVEY'
},
'deleted': {
'BOOL': False
},
'created': {
'S': '2020-02-11 21:48:05'
},
'activated': {
'BOOL': False
},
'step': {
'S': 'editor'
},
'owner': {
'N': '12'
},
'built': {
'BOOL': False
},
'name': {
'S': 'Survey UM'
},
'up_lime': {
'BOOL': False
},
'lang': {
'S': 'pt'
},
'teste': {
'M': {
'test': {
'M': {
'test2': {
'N': '54'
}
}
}
}
}
}
type_deserializer = TypeDeserializer()
py_data = {k: type_deserializer.deserialize(v) for k,v in item.items()}
pprint.pprint(py_data)
The output is:
{'activated': False,
'built': False,
'created': '2020-02-11 21:48:05',
'deleted': False,
'id_': 'ID_DA_SURVEY',
'lang': 'pt',
'last_updated': '2020-02-11 21:48:05',
'name': 'Survey UM',
'owner': Decimal('12'),
'step': 'editor',
'teste': {'test': {'test2': Decimal('54')}},
'up_lime': False}

TypeError: string indices must be integers - json

I want get value (abc.com/p/B3N) from this json :
{'id': 123456, 'parent_id': 0, 'number': '23856', 'order_key': 'abc', 'created_via': 'checkout', 'version': '3.6.4', 'status': 'processing', 'currency': 'USD', 'date_created': '2019-10-05T13:18:49', 'date_created_gmt': '2019-10-05T13:18:49', 'date_modified': '2019-10-05T13:19:20', 'date_modified_gmt': '2019-10-05T13:19:20', 'discount_total': '0.00', 'discount_tax': '0.00', 'shipping_total': '0.00', 'shipping_tax': '0.00', 'cart_tax': '0.00', 'total': '0.40', 'total_tax': '0.00', 'prices_include_tax': False, 'customer_id': 0, 'customer_ip_address': '111.101.111.111', 'customer_user_agent': 'Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-J337P) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/10.1 Chrome/71.0.3578.99 Mobile Safari/537.36', 'customer_note': '', 'billing': {'first_name': '', 'last_name': '', 'company': '', 'address_1': '', 'address_2': '', 'city': '', 'state': '', 'postcode': '', 'country': '', 'email': 'abc#gmail.com', 'phone': ''}, 'shipping': {'first_name': '', 'last_name': '', 'company': '', 'address_1': '', 'address_2': '', 'city': '', 'state': '', 'postcode': '', 'country': ''}, 'payment_method': 'paypal', 'payment_method_title': 'PayPal', 'transaction_id': '851R', 'date_paid': '2019-10-05T13:19:20', 'date_paid_gmt': '2019-10-05T13:19:20', 'date_completed': None, 'date_completed_gmt': None, 'cart_hash': '0675772a1e', 'meta_data': [{'id': 123456, 'key': 'is_vat_exempt', 'value': 'no'}, {'id': 123456, 'key': 'Payment type', 'value': 'instant'}, {'id': 274929, 'key': '_paypal_status', 'value': 'completed'}, {'id': 123456, 'key': 'PayPal Transaction Fee', 'value': '0.32'}], 'line_items': [{'id': 10927, 'name': 'Jeans', 'product_id': 1234, 'variation_id': 0, 'quantity': 1, 'tax_class': '', 'subtotal': '0.10', 'subtotal_tax': '0.00', 'total': '0.10', 'total_tax': '0.00', 'taxes': [], 'meta_data': [{'id': 100000, 'key': '', 'value': 'Views $0.00 × 500'}, {'id': 100001, 'key': '', 'value': 'Worldwide'}, {'id': 100002, 'key': '', 'value': 'abc.com/p/B3N'}, {'id': 100003, 'key': '', 'value': '17'}], 'sku': '', 'price': 0.1}], 'tax_lines': [], 'shipping_lines': [], 'fee_lines': [{'id': 10928, 'name': 'PayPal Fee (Free Fee for order over $5)', 'tax_class': '0', 'tax_status': 'taxable', 'amount': '0.3', 'total': '0.30', 'total_tax': '0.00', 'taxes': [], 'meta_data': [{'id': 122543, 'key': '_legacy_fee_key', 'value': 'paypal-fee'}]}], 'coupon_lines': [], 'refunds': [], '_links': {'self': [{'href': 'abc.com'}], 'collection': [{'href': 'abc.com'}]}}
this is my code
m = (wcapi.get(order + ordernumber).json())
n = json.dumps(m)
o = json.loads(n)
for i in o:
if i['id'] == '100002':
print(i['value'])
break
and i got this error :
if i['id'] == '100002':
TypeError: string indices must be integers
i have searched others topics but ... can't. thanks for help me!
When you do for i in o and o is a dictionary, the for loop iterates over the keys in o - which are strings in your case. Hence the error. i is a string.
To get the key you need to know the exact structure of o.
I'm gonna give you some examples:
o['id'] # 123456
o['billing']['email'] # "abc#gmai.com"
Now to get the value you want:
first_line_items_meta = o['line_items'][0]['metadata']
for item in first_line_items_meta:
if item['id'] == 100002:
print(item['value']) # "abc.com/p/B3N"

Button alignment in Adaptive cards

I was wondering if there is a way to control alignment of buttons in Adaptive card in Bot Emulator.
I tried the same code in the emulator, and the Microsoft Visualizer, but they render differently. Here are the images: Emulator Visualizer
Here's the code I've used:
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
'$schema': 'http://adaptivecards.io/schemas/adaptive-card.json',
'version': '1.0',
'type': 'AdaptiveCard',
'body': [
{
'type': 'TextBlock',
'text': 'Meeting Title',
'weight': 'bolder'
},
{
'type': 'TextBlock',
'text': 'Location',
'separator': true,
'isSubtle': true,
'size': 'small'
},
{
'type': 'TextBlock',
'text': 'Location',
'spacing': 'none'
},
{
'type': 'TextBlock',
'text': 'Organizer',
'separator': true,
'isSubtle': true,
'size': 'small'
},
{
'type': 'TextBlock',
'text': 'Organizer Name',
'spacing': 'none'
},
{
'type': 'TextBlock',
'text': 'Start Time',
'separator': true,
'isSubtle': true,
'size': 'small'
},
{
'type': 'ColumnSet',
'spacing': 'none',
'columns': [
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': '05:00 PM',
'isSubtle': false,
'weight': 'bolder'
}
]
},
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': 'May 21'
}
]
},
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': '2017',
'isSubtle': true,
'weight': 'bolder'
}
]
}
]
},
{
'type': 'TextBlock',
'text': 'End Time',
'separator': true,
'isSubtle': true,
'size': 'small'
},
{
'type': 'ColumnSet',
'spacing': 'none',
'columns': [
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': '05:30 PM',
'isSubtle': false,
'weight': 'bolder'
}
]
},
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': 'May 21'
}
]
},
{
'type': 'Column',
'width': 'auto',
'items': [
{
'type': 'TextBlock',
'text': '2017',
'isSubtle': true,
'weight': 'bolder'
}
]
}
]
}
],
'actions': [
{
'type': 'Action.Submit',
'title': 'Accept',
'data':{
'accept': true
}
},
{
'type': 'Action.Submit',
'title': 'Decline',
'data':{
'accept': false
}
}
]
}
}
As seen, the buttons are aligned horizontally in the emulator, and next to each other in the visualizer. Is there a way to modify the height and width of the buttons, as well as the way they are aligned?
I was wondering if there is a way to control alignment of buttons in
Adaptive card in Bot Emulator.
Short answer is "No". You cannot modify the render of components in the Emulator.
Long answer is: Bot Framework Emulator is open-source, so you can try to modify and run locally your custom emulator. But I'm not sure that making a custom render on the emulator is very useful for real projects, as they will not run on the emulator.
Emulator sources are located here: https://github.com/Microsoft/BotFramework-Emulator
There is something called Hostconfig with Adaptive cards, try using that. Have shared the editor tool link.

Resources