From 9903e85a66315c16e6f88ea1bb04a8c1d6ea7c18 Mon Sep 17 00:00:00 2001 From: BlipRanger <1860540+BlipRanger@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:03:49 -0400 Subject: [PATCH] Add random slash command --- public/script.js | 1 + public/scripts/power-user.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/public/script.js b/public/script.js index a473c1301..2a23757a9 100644 --- a/public/script.js +++ b/public/script.js @@ -172,6 +172,7 @@ export { select_rm_info, setCharacterId, setCharacterName, + replaceCurrentChat, setOnlineStatus, checkOnlineStatus, setEditedMessageId, diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index d6de47d9b..11688cc6f 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -14,6 +14,8 @@ import { getCurrentChatId, name1, name2, + replaceCurrentChat, + setCharacterId } from "../script.js"; import { favsToHotswap } from "./RossAscends-mods.js"; import { @@ -929,6 +931,14 @@ function doNewChat() { }, 1); } +function doRandomChat() { + setCharacterId(Math.floor(Math.random() * characters.length)); + setTimeout(() => { + replaceCurrentChat(); + }, 1); + +} + function doDelMode() { setTimeout(() => { $("#option_delete_mes").trigger('click') @@ -1326,5 +1336,6 @@ $(document).ready(() => { registerSlashCommand('vn', toggleWaifu, ['vn'], ' – swaps Visual Novel Mode On/Off', false, true); registerSlashCommand('newchat', doNewChat, ['newchat'], ' – start a new chat with current character', true, true); + registerSlashCommand('random', doRandomChat, ['random'], ' – start a new chat with a random character', true, true); registerSlashCommand('delmode', doDelMode, ['delmode'], ' – enter message deletion mode', true, true); });