You can make a script that when 'DnD' is enabled it will block all incoming messages (by closing the conversation as soon as a message is received), but still allow you to talk to your contacts. Then you can just disable it when you want to
I think thats what you mean?