What could be causing the timeout issue when trying to fetch guild members?

Hey there! I need some help with my discord bot. I'm trying to get a list of members ordered by their ids, but when I run the code below, all it does is log "Couldn't fetch members" without any other errors showing up.

After digging deeper, I realized that it's actually a timeout error. Everything seems to be fine otherwise, and I don't think the issue lies with the const guild. Hopefully, someone can assist me on this. Cheers!

const IDs = new Map();
var repeat = new Boolean(false);
var randomInt = new Number(0);

client.on('ready', () => {
    console.log('Ready!');
    const guild = client.guilds.cache.get("xxxxxxxxxxxxxxxxxx");
    guild.members.fetch().then(members => {
        console.log("Found the members");
        IDs = members.map(user => user.id);
        const OnlineMembers = members.filter(member => member.presence.status == "online");
    }).catch(e => console.log("Couldn't fetch members."));
});

P.S. This code is running on a Raspberry Pi using Nodemon --inspect, in case that makes a difference

Answer №1

After some exploration, I managed to locate the solution on my own. Apologies if my previous queries caused any inconvenience. It turns out there's a minuscule setting in the Discord Dev Hub that controls this feature. Clearly, I overlooked activating it initially due to my oversight. Grateful for everyone who assisted me with this issue. Cheers!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Looping through and printing JSON strings

Currently, I am dealing with a JSON string of this specific format: {"prey":["{\"distance\": 8.686924173343307, \"signal\": \"-59\", \"frequency\": 2447, \"mac\": \"00:00:00:00:00:00\", \"ip ...

Executing a mousedown event in Ajax while simultaneously running another JavaScript function using JQuery

One issue I am facing involves a JavaScript method. There is a date slider for months that triggers an AJAX call when the month is changed (mouseup event). Within this AJAX call, there is another JavaScript code ($.blockUI) which seems to interfere with th ...

Troubleshooting a simple test issue with React AXIOS post in an Express environment

I have successfully created a React front end and used a basic boilerplate to connect it with Express. However, I am now faced with the challenge of setting up a simple RESTful API, and the myriad of options available is overwhelming. My goal is to establi ...

sending a collection of elements to a jQuery function

I am puzzled by why this function is not working as expected when passing an array of items to it. My intention with the for-loop is to change the status of the child ctrl element to either '+' or '-'. An error occurred: Uncaught Typ ...

What could be causing my NextAuthJS discord login to function in the test environment but fail to deploy in production on NextJS 13?

After attempting to deploy my NextJS application on Vercel, I encountered a problem with the AuthJS sign-in model. While running the program using npm run dev, everything works smoothly and I can log in to my Discord account linked to the developer portal& ...

JQuery: Creating a visually striking screen flash

How can I make the window or page flash/blink using JQuery or plain JavaScript? I also want to get the tab to flash at the same time. Currently, the code I have is: var flash = true; var alert = setInterval(function(){ if (flash) //doFlash ...

jQuery can be used to access and read the `$_FILES['name']['tmp_name']` data

I am working on an application to import Excel files into a database using excel_reader2.php. I have set up a form for uploading the Excel file, and once the desired file is selected, I need to read the data from the worksheet of the Excel file. However, I ...

Is there a way to develop a search script that can efficiently sift through the object using the provided script or a similar one?

$(document).ready(function(){ $.ajax({ dataType: 'jsonp', //data in jsonp contentType: "application/json; charset=utf-8", url: 'http://live.nhle.com/GameData/RegularSeasonScoreboardv3.jsonp', ...

Using jQuery to import an external script into a React JS project

I'm looking to integrate an external JavaScript file (using jQuery) into a ReactJS project. While I found some guidance on this page, I am still encountering errors. The external JS file is named external.js: $(document).ready(function() { docu ...

Troubleshooting issues with Vue.js page routing

Currently, I am diving into the world of vue.js and encountering difficulties with setting up routing. My goal is to utilize templates stored in separate HTML files, rather than inline templates. The issue I'm facing is that the routing does not seem ...

Configuring the default value for a selection menu in Vue3

Obtaining all available categories: const fetchCategories = async () => { let response = await axios.get(`/api/get_all_category/`) categories.value = response.data.categories } The structure of categories.value is shown here: https://i.sstatic.net ...

How can I transfer data to a different component in Angular 11 that is not directly related?

Within the home component, there is a line that reads ...<app-root [message]="hii"> which opens the app-root component. The app-root component has an @input and {{message}} in the HTML is functioning properly. However, instead of opening t ...

What is the best way to create a button that can cycle through various divs?

Suppose I want to create a scroll button that can navigate through multiple div elements. Here is an example code snippet: <div id="1"></div> <div id="2"></div> <div id="3"></div> <div id="4"></div> <div ...

Unspecified outcome of Ajax array as a choice in Select

I'm fairly new to working with AJAX / JSON and I'm having trouble figuring out how to parse an AJAX array response into a <select> dropdown. Despite going through several online tutorials and attempting different approaches to return the r ...

Yarn installation halted due to an unexpected end of file

Encountering an issue with npm/yarn. Our private npm registry is hosted on a VM using Verdaccio to manage our packages. Whenever we install external packages for the first time, they are redirected to registry.npmjs.org through http://localhost:4873 and th ...

Ensuring Consistency in Object Size When Switching Between Perspective and Orthographic Cameras

Struggling to toggle between Perspective and Orthographic cameras in my script. I need objects at certain depths to maintain their projection size. I've reached a point of confusion when trying to understand the geometry... Can anyone recommend a sim ...

Tips for preventing the use of nested functions while working with AJAX?

Consecutively making asynchronous calls can be messy. Is there a cleaner alternative? The issue with the current approach is its lack of clarity: ajaxOne(function() { // do something ajaxTwo(function() { // do something ajaxThree() }); }); ...

When getStaticPaths and getStaticProps are programmed to deliver results

Seeking assistance with my first attempt at using getStaticPaths and getStaticProps in nextJS as a beginner. Can anyone help me resolve this issue? const datas = [ { id: 1, name: "Banheiro", image: "https://res.cl ...

The background image fails to display properly on the server in Next.js

Hello, I'm currently using NextJs and I have a challenge. I want to set a background image on the body element that is rendered server-side. Below you'll find my code snippets: First, here is my App.js: import BodyStyle from '@components/Bo ...

"Encountered an undefined error with the title property of this.state.project in the Wordpress API

I'm currently working on a project that involves a Backend Wordpress and a front-end React setup. However, I've encountered an issue when attempting to retrieve the title.rendered from the JSON Data. This error is displayed: TypeError: this.sta ...