feat: Implementar nuevas mejoras en Amayo Bot Editor
- Agregar selector de directorio multi-OS con validación y persistencia - Implementar preview en tiempo real del código generado en CommandCreator y EventCreator - Activar TypeScript strict mode y añadir snippets nativos para mejorar la experiencia de desarrollo - Crear documentación detallada sobre las nuevas funcionalidades y cambios realizados - Actualizar README con instrucciones de uso y solución de problemas comunes - Modificar archivos clave para integrar las nuevas características y mejorar la usabilidad
This commit is contained in:
@@ -331,6 +331,11 @@ function showDeleteConfirmation() {
|
|||||||
const target = contextMenu.value.target;
|
const target = contextMenu.value.target;
|
||||||
if (!target) return;
|
if (!target) return;
|
||||||
|
|
||||||
|
console.log('🗑️ Preparando eliminación de:', target);
|
||||||
|
console.log(' name:', target.name);
|
||||||
|
console.log(' path:', target.path);
|
||||||
|
console.log(' relativePath:', target.relativePath);
|
||||||
|
|
||||||
deleteModal.value = {
|
deleteModal.value = {
|
||||||
visible: true,
|
visible: true,
|
||||||
target: target,
|
target: target,
|
||||||
@@ -422,9 +427,15 @@ async function handleCreateFolder(folderName: string, parentFolder: string) {
|
|||||||
|
|
||||||
async function handleRename(file: FileInfo, newName: string) {
|
async function handleRename(file: FileInfo, newName: string) {
|
||||||
try {
|
try {
|
||||||
const oldPath = `${props.projectRoot}/${file.relative_path}`;
|
// Usar el path completo directamente
|
||||||
const dirPath = file.relative_path.substring(0, file.relative_path.lastIndexOf('/'));
|
const oldPath = file.path;
|
||||||
const newPath = `${props.projectRoot}/${dirPath}/${newName}`;
|
|
||||||
|
// Extraer el directorio del path completo
|
||||||
|
const lastSlash = oldPath.lastIndexOf('/') !== -1 ? oldPath.lastIndexOf('/') : oldPath.lastIndexOf('\\');
|
||||||
|
const dirPath = oldPath.substring(0, lastSlash);
|
||||||
|
const newPath = `${dirPath}/${newName}`;
|
||||||
|
|
||||||
|
console.log('📝 Renombrando:', oldPath, '→', newPath);
|
||||||
|
|
||||||
await invoke('rename_file', { oldPath, newPath });
|
await invoke('rename_file', { oldPath, newPath });
|
||||||
|
|
||||||
@@ -441,7 +452,14 @@ async function handleDelete() {
|
|||||||
if (!target) return;
|
if (!target) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fullPath = `${props.projectRoot}/${target.relative_path}`;
|
// Construir la ruta completa
|
||||||
|
// El path ya es la ruta completa desde Rust
|
||||||
|
let fullPath: string = target.path;
|
||||||
|
|
||||||
|
console.log('🗑️ Eliminando archivo:', fullPath);
|
||||||
|
console.log(' Target completo:', JSON.stringify(target, null, 2));
|
||||||
|
console.log(' basePath:', props.basePath);
|
||||||
|
console.log(' projectRoot:', props.projectRoot);
|
||||||
|
|
||||||
if (deleteModal.value.isFolder) {
|
if (deleteModal.value.isFolder) {
|
||||||
await invoke('delete_folder', { folderPath: fullPath });
|
await invoke('delete_folder', { folderPath: fullPath });
|
||||||
@@ -449,10 +467,11 @@ async function handleDelete() {
|
|||||||
await invoke('delete_file', { filePath: fullPath });
|
await invoke('delete_file', { filePath: fullPath });
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('notify', `✅ Eliminado correctamente`, 'success');
|
emit('notify', `✅ Eliminado correctamente: ${target.name}`, 'success');
|
||||||
emit('refresh');
|
emit('refresh');
|
||||||
closeDeleteModal();
|
closeDeleteModal();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error('❌ Error eliminando:', error);
|
||||||
emit('notify', `❌ Error eliminando: ${error}`, 'error');
|
emit('notify', `❌ Error eliminando: ${error}`, 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export interface ProjectStats {
|
|||||||
export interface FileInfo {
|
export interface FileInfo {
|
||||||
name: string;
|
name: string;
|
||||||
path: string;
|
path: string;
|
||||||
relative_path: string;
|
relativePath: string; // camelCase porque Rust usa #[serde(rename_all = "camelCase")]
|
||||||
type: "command" | "event";
|
type: "command" | "event";
|
||||||
commandType?: "message" | "slash";
|
commandType?: "message" | "slash";
|
||||||
eventType?: "standard" | "extra";
|
eventType?: "standard" | "extra";
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import type { Message } from "discord.js";
|
|
||||||
import type Amayo from "../../core/client";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Everyone",
|
|
||||||
description: "Has reply everyone",
|
|
||||||
type: 'message' as const,
|
|
||||||
category: "any",
|
|
||||||
cooldown: 1,
|
|
||||||
async run(message: Message, args: string[], client: Amayo) {
|
|
||||||
// Tu código aquí
|
|
||||||
await message.reply("¡Comando Everyone ejecutado!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import type { Message } from "discord.js";
|
|
||||||
import type Amayo from "../../core/client";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "sdfsdfsdf",
|
|
||||||
description: "dfsdf",
|
|
||||||
type: 'message' as const,
|
|
||||||
aliases: ["dfsf"],
|
|
||||||
async run(message: Message, args: string[], client: Amayo) {
|
|
||||||
// Tu código aquí
|
|
||||||
await message.reply("¡Comando sdfsdfsdf ejecutado!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user