diff --git a/public/script.js b/public/script.js index a160d723b..e11c5613c 100644 --- a/public/script.js +++ b/public/script.js @@ -179,6 +179,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 60a608f01..3d4aa6f39 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -15,6 +15,8 @@ import { printCharacters, name1, name2, + replaceCurrentChat, + setCharacterId } from "../script.js"; import { favsToHotswap, isMobile } from "./RossAscends-mods.js"; import { @@ -991,6 +993,14 @@ function doNewChat() { }, 1); } +function doRandomChat() { + setCharacterId(Math.floor(Math.random() * characters.length)); + setTimeout(() => { + replaceCurrentChat(); + }, 1); + +} + function doDelMode() { setTimeout(() => { $("#option_delete_mes").trigger('click') @@ -1393,5 +1403,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); });