You would need to create a script in Self for this. Self is a dialect of JavaScript and is object oriented and persistent, so make it easy to define complex data. Here is an example script, https://www.botlibre.com/script?id=17010244