You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, let's say I want to the bot to select one out of 2 images when it reads a certain word.
To accomplish this, I tried modelling after samples/random-reaction.yaml, specifically the random filter and combined it with my replymedia template. However, now my selection isn't a basic object anymore, but a dict whose value I need to access.
The object can contain variables using a custom syntax: All instances of
`$${variablename}` will be replaced with the value matching `variablename`.
This custom syntax does not appear to allow this in any way I tried, such as $${selection.url} or $${selection[url]} or $${selection['url']}.
Next I tried json, at which point I'm limited by having to use " double quotes for each key and value as well as the whole content being a string so the parser does not try to interpret it as yaml object. After failing with the usual escape syntax, I accomplished this by this syntax
content: >
{"key": "{{selection['value']}}"}
and other ways to access the dict, but again this does not appear to work, the jinja templated parts are simply empty.
Then I tried providing the whole object in the rule's variables and discard the reply field for now, but still failed with errors that I don't understand at this point, like AttributeError: 'CommentedSeq' object has no attribute 'items'.
I would like the custom syntax to support subscription if possible.
Where did I go wrong with jinja? Can you provide an example if this is possible?
Where did I go wrong in my brute force approach? Is this currently possible at all?
The text was updated successfully, but these errors were encountered:
For example, let's say I want to the bot to select one out of 2 images when it reads a certain word.
To accomplish this, I tried modelling after samples/random-reaction.yaml, specifically the
random
filter and combined it with my replymedia template. However, now my selection isn't a basic object anymore, but a dict whose value I need to access.reactbot/README.md
Lines 29 to 30 in a1e5d2c
This custom syntax does not appear to allow this in any way I tried, such as
$${selection.url}
or$${selection[url]}
or$${selection['url']}
.Next I tried json, at which point I'm limited by having to use
"
double quotes for each key and value as well as the wholecontent
being a string so the parser does not try to interpret it as yaml object. After failing with the usual escape syntax, I accomplished this by this syntaxand other ways to access the dict, but again this does not appear to work, the jinja templated parts are simply empty.
Then I tried providing the whole object in the rule's variables and discard the reply field for now, but still failed with errors that I don't understand at this point, like
AttributeError: 'CommentedSeq' object has no attribute 'items'
.The text was updated successfully, but these errors were encountered: