How to MAKE SURE to get the last bot message?

Like other users, I 'm trying to get the last bot message. I’ve created a custom action with “‘text’)”. My problem is: depending on the situation (for example, whether there was a custom action launched just after the latest bot message or not), the event connected to the last bot message is not always at the same rank of the events. So I sometimes need a[-7].get(‘text’) to get the latest bot message. But in other scenarios, it could be[-6].get(‘text’) or[-5].get(‘text’). So at the end, it is quite complicate to retrieve what the bot has just said. What are the solutions? Wouldn’t it be possible to always copy what the bot says on a special slot? And then to get the message from that slot if needed. But how to proceed? Thanks.