I am trying to add timestamp to every dialog in botpress chat. So far I am able to add this timestamp in bot's dialog, but I need some pointers in adding the same to user's dialog and choice skill.
Screenshot from chat showing timestamp in bot's dialog
Custom component
export class InfaText extends React.Component {
message = this.props.text
getTimestamp = () => {
let date = new Date();
let options = {
month: "short",
day: "numeric", hour: "2-digit", minute: "2-digit"
};
return date.toLocaleTimeString("en-us", options);
}
render() {
return (<div className="infaTextMain">
<p className="infaTextMessage">{this.message}</p>
<small className="infaTextTimestamp">{this.getTimestamp()}</small>
</div>)
}
}
Note: Botpress v11.9.5
Also, is there a generic way to add a timestamp to all dialogs? Update
I followed exactly as stated by @eff_it
I copied MessageWrapper & MySuperOverride functions to modules\infa-module\src\views\lite\index.jsx
Then added below snippet under overrides of modules\channel-web\src\views\full\index.tsx
file
{
module: 'infa-module',
component: 'MySuperOverride'
}
Still no effect, @eff_it please have a look and suggest is it something that is missing here?