I’d say you’re not too far off, I’ll write it a bit differently tho’:
$(eval q = '$(query)'.toLowerCase(); r = Math.floor(Math.random() * X); o = 'Please rerun the command with either OPTION_1 or OPTION_2'; if (q.includes('OPTION_1')) {o='SENTENCE_1'} if (q.includes('OPTION_2')) {r === 0 ? o = 'SENTENCE_2' : o = 'SENTENCE_3'} o;)
Right now, if the entry contains both OPTION_1 and OPTION_2 (regardless of the order they’re in), the code favors OPTION_2, add an else before the second if to favor OPTION_1 instead.
The ternary operator is fun and all, but sometimes good old ifs make the code easier to read and debug.