Creating an AppleScript script that can interact with the systems Do Not Disturb mode

Hi everyone, I am trying to write an AppleScript script in Nodejs that can interact with the system’s Do Not Disturb Mode. Please how do I write this?

Charles. I’m not familiar with NodeJS and can’t help there.

FWIW, one solution is to call a shortcut from an AppleScript, although this requires a recent version of macOS. A simple AppleScript example:

set doNotDisturbStatus to "Turn Off" --either "Turn On" or "Turn Off"

if doNotDisturbStatus is "Turn On" then
	tell application "Shortcuts Events" to run shortcut named "Do Not Disturb" with input doNotDisturbStatus
else
	tell application "Shortcuts Events" to run shortcut named "Do Not Disturb" with input doNotDisturbStatus
end if

The shortcut:

Do Not Disturb.shortcut (22.1 KB)

Thank @peavine. I’ll try this out to see if it works.