mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-21 14:40:48 +01:00
Add is-mobile command and macro
This commit is contained in:
parent
5739efc59b
commit
d9101ce679
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
<li><tt>{{random::(arg1)::(arg2)}}</tt> – <span data-i18n="help_macros_38">alternative syntax for random that allows to use commas in the list items.</span></li>
|
||||
<li><tt>{{pick::(args)}}</tt> – <span data-i18n="help_macros_39">picks a random item from the list. Works the same as {{random}}, with the same possible syntax options, but the pick will stay consistent for this chat once picked and won't be re-rolled on consecutive messages and prompt processing.</span></li>
|
||||
<li><tt>{{banned "text here"}}</tt> – <span data-i18n="help_macros_40">dynamically add text in the quotes to banned words sequences, if Text Generation WebUI backend used. Do nothing for others backends. Can be used anywhere (Character description, WI, AN, etc.) Quotes around the text are important.</span></li>
|
||||
<li><tt>{{isMobile}}</tt> – <span data-i18n="help_macros_isMobile">"true" if currently running in a mobile environment, "false" otherwise</span></li>
|
||||
</ul>
|
||||
<div data-i18n="Instruct Mode and Context Template Macros:">
|
||||
Instruct Mode and Context Template Macros:
|
||||
|
Loading…
x
Reference in New Issue
Block a user