diff --git a/public/scripts/macros.js b/public/scripts/macros.js
index ea6b64b67..cbc38ded4 100644
--- a/public/scripts/macros.js
+++ b/public/scripts/macros.js
@@ -4,6 +4,7 @@ import { timestampToMoment, isDigitsOnly, getStringHash, escapeRegex, uuidv4 } f
import { textgenerationwebui_banned_in_macros } from './textgen-settings.js';
import { getInstructMacros } from './instruct-mode.js';
import { getVariableMacros } from './variables.js';
+import { isMobile } from './RossAscends-mods.js';
/**
* @typedef Macro
@@ -542,5 +543,6 @@ export function initMacros() {
});
}
+ MacrosParser.registerMacro('isMobile', () => String(isMobile()));
initLastGenerationType();
}
diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js
index 5cb76d06d..7265b76bf 100644
--- a/public/scripts/slash-commands.js
+++ b/public/scripts/slash-commands.js
@@ -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() {
`,
}));
+ 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 {{isMobile}}
macro.',
+ }));
registerVariableCommands();
}
diff --git a/public/scripts/templates/macros.html b/public/scripts/templates/macros.html
index 84a163c4e..7490596d3 100644
--- a/public/scripts/templates/macros.html
+++ b/public/scripts/templates/macros.html
@@ -48,6 +48,7 @@