How to set a variable based on telegram arg

Hi,

Im new on this… and probably im not using the correct words.

I’d like to set an “alarm” based on some movement sensors. The overall idea is to enable/disable the alarm based on a telegram message.

In other words, send a message thru telegram like /alarm on.
“save” the ‘on’ argument as a variable and use the ‘on’ arg for the And If condition.

In pseudocode,
IF movement detected
And If arg ‘on’

Do something…

Again, thanks in advance for your support.