Use the on playend event :
The on PLAYEND event triggers when the /play command has finished playing a file.
Format: on <level>:PLAYEND:<commands>
Example: on 1:PLAYEND:/echo The play command has finished playing $filename
Note: Text files can be played ie. sent to users or channels on IRC by using the /play command.