Add is-mobile command and macro

This commit is contained in:
Cohee
2024-12-21 22:25:14 +02:00
parent 5739efc59b
commit d9101ce679
3 changed files with 10 additions and 1 deletions

View File

@ -47,7 +47,7 @@ import {
} from '../script.js';
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
import { SlashCommandParserError } from './slash-commands/SlashCommandParserError.js';
import { getMessageTimeStamp } from './RossAscends-mods.js';
import { getMessageTimeStamp, isMobile } from './RossAscends-mods.js';
import { hideChatMessageRange } from './chats.js';
import { getContext, saveMetadataDebounced } from './extensions.js';
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
@ -1958,6 +1958,12 @@ export function initDefaultSlashCommands() {
</div>
`,
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'is-mobile',
callback: () => String(isMobile()),
returns: ARGUMENT_TYPE.BOOLEAN,
helpString: 'Returns true if the current device is a mobile device, false otherwise. Equivalent to <code>{{isMobile}}</code> macro.',
}));
registerVariableCommands();
}