Skip to content

其他辅助功能

getIframeName

获取 iframe 的名称。

typescript
function getIframeName(): string;

返回值

  • iframe 名称: string
    • 对于楼层消息是 message-楼层id-是该楼层第几个iframe
    • 对于全局脚本是 script-脚本名称

getMessageId

从消息楼层 iframe 的 iframe_name 获取它所在楼层的楼层 id。

只能对楼层消息 iframe 使用

typescript
function getMessageId(iframe_name: string): number;

参数

iframe_name

  • 类型: string
  • 描述: 消息楼层 iframe 的名称

返回值

  • 楼层 id: number

getCurrentMessageId

获取本消息楼层 iframe 所在楼层的楼层 id。

只能对楼层消息 iframe 使用

typescript
function getCurrentMessageId(): number;

返回值

  • 楼层 id: number

substitudeMacros

替换字符串中的 SillyTavern 宏。

typescript
async function substitudeMacros(text: string): Promise<string>;

参数

text

  • 类型: string
  • 描述: 需要替换的字符串

返回值

  • 替换结果: string

示例

typescript
const text = substitudeMacros("{{char}} speaks in {{lastMessageId}}");
text == "少女歌剧 speaks in 5";

getLastMessageId

获取最新楼层 id。

typescript
async function getLastMessageId(): Promise<number>;

返回值

  • 最新楼层 id: number

作者:KAKAA, 青空莉想做舞台少女的狗