refactor(slash-commands): 重命名 goto-floor 命令为 chat-jump - 将命令名称从 'goto-floor' 修改为 'chat-jump',以更好地反映其功能

59ebf2e5b8a23080bec1ed05d152ad1c61a323ec

awaae001 <3271436144@qq.com>

1 files changed, +7 -7Showing whitespace changes
public/scripts/slash-commands.js+7 -7
@@ -2132,7 +2132,7 @@ export function initDefaultSlashCommands() {
21322132 }));
21332133
21342134 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
21352135 name: 'gotochat-floorjump',
21362136 aliases: ['floor', 'jump', 'scrollto'],
21372137 callback: async (_, index) => {
21382138 const floorIndex = Number(index);
@@ -2141,16 +2141,16 @@ export function initDefaultSlashCommands() {
21412141 if (isNaN(floorIndex) || floorIndex < 0 || (chatLength !== -1 && floorIndex >= chatLength)) {
21422142 const maxIndex = (chatLength !== -1 ? chatLength - 1 : 'unknown');
21432143 toastr.warning(`Invalid message index: ${index}. Please enter a number between 0 and ${maxIndex}.`);
21442144 console.warn(`WARN: Invalid message index provided for /gotochat-floorjump: ${index}. Max index: ${maxIndex}`);
21452145 return '';
21462146 }
21472147
21482148 // --- Load all messages first to ensure the target element exists ---
21492149 console.log(`INFO: Attempting to load all messages before attempting to gotochat-floorjump ${index}.`);
21502150 try {
21512151 // Assuming showMoreMessages is available globally or within scope
21522152 await showMoreMessages(Number.MAX_SAFE_INTEGER);
21532153 console.log(`'INFO: All messages loaded (or loading initiated).`');
21542154 // Give the rendering a moment to potentially catch up after showMoreMessages
21552155 await new Promise(resolve => setTimeout(resolve, 100)); // Adjust delay if needed
21562156 } catch (error) {
@@ -2192,7 +2192,7 @@ export function initDefaultSlashCommands() {
21922192 } else {
21932193 // Only warn if element is not found *after* attempting to load all messages
21942194 toastr.warning(`Could not find element for message ${floorIndex} (using [mesid="${floorIndex}"]) even after attempting to load all messages. It might not be rendered yet or the index is invalid.`);
21952195 console.warn(`WARN: Element not found for message index ${floorIndex} using querySelector [mesid="${floorIndex}"] in /gotochat-floorjump, even after attempting to load all messages.`);
21962196 // Do NOT scroll the chat container in this case
21972197 }
21982198 return ''; // Return empty string as expected by some slash command parsers
@@ -2213,12 +2213,12 @@ export function initDefaultSlashCommands() {
22132213 A warning is displayed if the message element cannot be located even after attempting to load all messages.
22142214 </div>
22152215 <div>
22162216 <strong>Example:</strong> <pre><code>/gotochat-floorjump 10</code></pre> Scrolls to the 11th message (mesid=10).
22172217 </div>
22182218 `,
22192219 }));
22202220
22212221 const styleId = 'gotochat-floorjump-highlight-style';
22222222 if (document.getElementById(styleId)) {
22232223 document.getElementById(styleId).remove();
22242224 }