@troycurtisjr With help from someone on reddit, I was able to cobble together code that tests for Do Not Disturb status on Big Sur. The plist file ~/Library/Preferences/com.apple.ncprefs contains a plist item dnd_prefs. That item contains a base64-encoded binary plist (bplist). When that is decoded, if DND is enabled, it would look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>dndDisplayLock</key>
<false/>
<key>dndDisplaySleep</key>
<false/>
<key>dndMirrored</key>
<false/>
<key>facetimeCanBreakDND</key>
<false/>
<key>repeatedFacetimeCallsBreaksDND</key>
<false/>
<key>userPref</key>
<dict>
<key>date</key>
<date>2021-01-15T04:35:29Z</date>
<key>enabled</key>
<true/>
<key>reason</key>
<integer>1</integer>
</dict>
</dict>
</plist>
The presence of the <key>userPref</key> and the <key>enabled</key> within the adjacent <dict></dict> indicate DND is enabled.
So the following code produces 1 if DND is enabled, and 0 if it is disabled:
#!/bin/zsh
dnd_enabled=$(plutil -extract dnd_prefs xml1 -o - ~/Library/Preferences/com.apple.ncprefs.plist | xpath -q -e 'string(//data)' | base64 -D | plutil -convert xml1 - -o - | xpath -q -e 'boolean(//key[text()="userPref"]/following-sibling::dict/key[text()="enabled"])')
echo $dnd_enabled
Note: there seems to often be a lag time of a few seconds before the result reflects any change to DND.