|
|
|
@ -38,11 +38,11 @@ export class AdminService {
|
|
|
|
private static help(): string {
|
|
|
|
private static help(): string {
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
'Comandos de administración:',
|
|
|
|
'Comandos de administración:',
|
|
|
|
'- /admin pendientes',
|
|
|
|
'- /admin pendientes (alias: pending, pend)',
|
|
|
|
'- /admin habilitar-aquí',
|
|
|
|
'- /admin habilitar-aquí (alias: enable)',
|
|
|
|
'- /admin deshabilitar-aquí',
|
|
|
|
'- /admin deshabilitar-aquí (alias: disable)',
|
|
|
|
'- /admin allow-group <group_id@g.us>',
|
|
|
|
'- /admin allow-group <group_id@g.us> (alias: allow)',
|
|
|
|
'- /admin block-group <group_id@g.us>',
|
|
|
|
'- /admin block-group <group_id@g.us> (alias: block)',
|
|
|
|
].join('\n');
|
|
|
|
].join('\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ export class AdminService {
|
|
|
|
const rest = lower.slice('/admin'.length).trim();
|
|
|
|
const rest = lower.slice('/admin'.length).trim();
|
|
|
|
|
|
|
|
|
|
|
|
// /admin pendientes
|
|
|
|
// /admin pendientes
|
|
|
|
if (rest === 'pendientes') {
|
|
|
|
if (rest === 'pendientes' || rest === 'pending' || rest === 'pend') {
|
|
|
|
const rows = AllowedGroups.listByStatus('pending');
|
|
|
|
const rows = AllowedGroups.listByStatus('pending');
|
|
|
|
if (!rows || rows.length === 0) {
|
|
|
|
if (!rows || rows.length === 0) {
|
|
|
|
return [{ recipient: sender, message: '✅ No hay grupos pendientes.' }];
|
|
|
|
return [{ recipient: sender, message: '✅ No hay grupos pendientes.' }];
|
|
|
|
@ -79,7 +79,7 @@ export class AdminService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// /admin habilitar-aquí
|
|
|
|
// /admin habilitar-aquí
|
|
|
|
if (rest === 'habilitar-aquí' || rest === 'habilitar-aqui') {
|
|
|
|
if (rest === 'habilitar-aquí' || rest === 'habilitar-aqui' || rest === 'enable') {
|
|
|
|
if (!isGroupId(ctx.groupId)) {
|
|
|
|
if (!isGroupId(ctx.groupId)) {
|
|
|
|
return [{ recipient: sender, message: 'ℹ️ Este comando se debe usar dentro de un grupo.' }];
|
|
|
|
return [{ recipient: sender, message: 'ℹ️ Este comando se debe usar dentro de un grupo.' }];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -89,7 +89,7 @@ export class AdminService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// /admin deshabilitar-aquí
|
|
|
|
// /admin deshabilitar-aquí
|
|
|
|
if (rest === 'deshabilitar-aquí' || rest === 'deshabilitar-aqui') {
|
|
|
|
if (rest === 'deshabilitar-aquí' || rest === 'deshabilitar-aqui' || rest === 'disable') {
|
|
|
|
if (!isGroupId(ctx.groupId)) {
|
|
|
|
if (!isGroupId(ctx.groupId)) {
|
|
|
|
return [{ recipient: sender, message: 'ℹ️ Este comando se debe usar dentro de un grupo.' }];
|
|
|
|
return [{ recipient: sender, message: 'ℹ️ Este comando se debe usar dentro de un grupo.' }];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -99,8 +99,8 @@ export class AdminService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// /admin allow-group <jid>
|
|
|
|
// /admin allow-group <jid>
|
|
|
|
if (rest.startsWith('allow-group ')) {
|
|
|
|
if (rest.startsWith('allow-group ') || rest.startsWith('allow ')) {
|
|
|
|
const arg = rest.slice('allow-group '.length).trim();
|
|
|
|
const arg = (rest.startsWith('allow-group ') ? rest.slice('allow-group '.length) : rest.slice('allow '.length)).trim();
|
|
|
|
if (!isGroupId(arg)) {
|
|
|
|
if (!isGroupId(arg)) {
|
|
|
|
return [{ recipient: sender, message: '⚠️ Debes indicar un group_id válido terminado en @g.us' }];
|
|
|
|
return [{ recipient: sender, message: '⚠️ Debes indicar un group_id válido terminado en @g.us' }];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -110,8 +110,8 @@ export class AdminService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// /admin block-group <jid>
|
|
|
|
// /admin block-group <jid>
|
|
|
|
if (rest.startsWith('block-group ')) {
|
|
|
|
if (rest.startsWith('block-group ') || rest.startsWith('block ')) {
|
|
|
|
const arg = rest.slice('block-group '.length).trim();
|
|
|
|
const arg = (rest.startsWith('block-group ') ? rest.slice('block-group '.length) : rest.slice('block '.length)).trim();
|
|
|
|
if (!isGroupId(arg)) {
|
|
|
|
if (!isGroupId(arg)) {
|
|
|
|
return [{ recipient: sender, message: '⚠️ Debes indicar un group_id válido terminado en @g.us' }];
|
|
|
|
return [{ recipient: sender, message: '⚠️ Debes indicar un group_id válido terminado en @g.us' }];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|