Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
mongooseError: Operation `chatbots.findOne()` buffering timed out after 10000ms at Timeout.<anonymous>

I was making discord bot from youtube tutorial https://youtu.be/bD75JNQfeYM but the guy who make the youtube tutorial don't want to answer my question I got an error that say

Error: Operation chatbots.findOne() buffering timed out after 10000ms at Timeout.x

here are the code this is chatbot.js

const fetch = require('node-fetch');
const client = require('../index');
const {
    findOne
} = require('../models/chatbot');
const Schema = require('../models/chatbot');

client.on('messageCreate', async (message) => {
    if (message.author.bot) return 
    await Schema.findOne({
        guild: message.guild.id
    }, async (err, data) => {
        if (!data) return;
        if (err) throw err;
        const channell = data.channel


        if (message.channel.id === channell) {
            fetch(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}&yr0n57JXpCy7aXlzFmMchuas`) 
                .then(response => response.json())
                .then(data => {
                    message.reply(`> ${data.response}`)
                }) 
        }
    })
})

and this is command for chatbot

const {
    Client,
    Message,
    MessageEmbed
} = require('discord.js');
const Schema = require('../../models/chatbot')

module.exports = {
    name: 'set-chatbot',
    /*
     * @param {Client} client 
     * @param {Message} message 
     * @param {String[]} args 
     */
    run: async (client, message, args, Discord) => {
        const channell = message.mentions.channels.first()
        if (!channell) return message.reply('Please tell me a channel!');

        Schema.findOne({
            guild: message.guild.id
        }, async (err, data) => {
            if (data) data.delete()
            new Schema({
                guild: message.guild.id,
                channel: channell.id,
            }).save();
            message.channel.send('Done!')
        })
    }
}

this mongosose

const { mongooseConnectionString } = require("../config.json");
const mongoose = require("mongoose");

module.exports = () => {
    if (!mongooseConnectionString) return;

    mongoose.connect(mongooseConnectionString, {
        useFindAndModify: true,
        useUnifiedTopology: true,
    });
};

models

const mongoose = require('mongoose')

const chatbot = new mongoose.Schema({
    guild: String,
    channel: String
})

module.exports = mongoose.model("chatbot", chatbot);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda