8
index.js
8
index.js
@@ -430,6 +430,8 @@ function stopBitcoinMonitoring() {
|
|||||||
client.on(Events.InteractionCreate, async interaction => {
|
client.on(Events.InteractionCreate, async interaction => {
|
||||||
if (!interaction.isChatInputCommand()) return;
|
if (!interaction.isChatInputCommand()) return;
|
||||||
|
|
||||||
|
console.log(`Command received: ${interaction.commandName}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (interaction.commandName) {
|
switch (interaction.commandName) {
|
||||||
case 'ping':
|
case 'ping':
|
||||||
@@ -455,16 +457,22 @@ client.on(Events.InteractionCreate, async interaction => {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'search':
|
case 'search':
|
||||||
|
console.log('Search command received');
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
const query = interaction.options.getString('query');
|
const query = interaction.options.getString('query');
|
||||||
const mediaType = interaction.options.getString('type');
|
const mediaType = interaction.options.getString('type');
|
||||||
const count = interaction.options.getInteger('count') || 3;
|
const count = interaction.options.getInteger('count') || 3;
|
||||||
|
|
||||||
|
console.log(`Search parameters: query="${query}", type="${mediaType}", count=${count}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (mediaType === 'image') {
|
if (mediaType === 'image') {
|
||||||
|
console.log('Processing image search...');
|
||||||
// Enhanced image search with better filtering
|
// Enhanced image search with better filtering
|
||||||
const searchTerm = `${query} filetype:jpg OR filetype:png OR filetype:gif OR filetype:webp`;
|
const searchTerm = `${query} filetype:jpg OR filetype:png OR filetype:gif OR filetype:webp`;
|
||||||
|
console.log(`Search term: ${searchTerm}`);
|
||||||
const results = await googleIt({ query: searchTerm, limit: count * 3 });
|
const results = await googleIt({ query: searchTerm, limit: count * 3 });
|
||||||
|
console.log(`Got ${results.length} results from google-it`);
|
||||||
|
|
||||||
const imageResults = [];
|
const imageResults = [];
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
|
|||||||
Referencia en una nueva incidencia
Block a user