The Fabulous Geek
The Fabulous Geek
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by The Fabulous Geek on 10/13/2024 in #djs-questions
Is fetching all threads safe?
I am using private threads as a ticketing system. We have roughly 300 open threads. I currently fetch all the threads on the ready event so they are cached. I am doing this becuase when someone clicks the button to create a ticket, I am searching the titles of the existing tickets to see if they already have one open. I want to make sure that there is nothing I should be concerned about in doing this, especially in reguards to memory usage. (I have a memory leak somewhere, so I am investigating anything I am not fully sure about).
5 replies
DIAdiscord.js - Imagine a boo! 👻
Created by The Fabulous Geek on 10/6/2024 in #djs-questions
Posting img with REST
I may be approaching this in an inefficient manner, so while I am asking specifically how to post an image using REST, I am open to other ideas. My use case involves occasionally posting as the bot, typically components like buttons that are permanent. I prefer not to use / commands for these, as I only need to update if I change the code. These utility functions are currently written as mini-apps, creating a client, logging in, and then posting on the ready event. But I don't think this is the best way to do so, as I am now logging in as a second client. So, I have been trying to use a simple REST post. I got it working; not really hard, I can do text, buttons, menus, etc., but I can't get files (i.e., images) to post. Here is the relevant code I am using.
await rest.post(
Routes.channelMessages(config.devMaps.channels['selfService'] ?? ''),
{
body: {
files: [
{
attachment: `${join(import.meta.dirname, '../assets/images/self-service.png')}`,
},
],
content: 'Test',
},
},
);
await rest.post(
Routes.channelMessages(config.devMaps.channels['selfService'] ?? ''),
{
body: {
files: [
{
attachment: `${join(import.meta.dirname, '../assets/images/self-service.png')}`,
},
],
content: 'Test',
},
},
);
5 replies
DIAdiscord.js - Imagine a boo! 👻
Created by The Fabulous Geek on 8/2/2024 in #djs-questions
Troubleshoot Memory Issues
I have one app that is regularly getting killed by the system for memory consumption. Any tips on how to begin troubleshooting what is causing this would be appreciated.
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by The Fabulous Geek on 4/13/2024 in #djs-questions
Comparing commands
Rather than setting all commands when I change one command, I am looking at designing a system that fetches the commands already registered and compare the commands in the files then only update any new, changed or deleted commands. I have found the ApplicationCommand.equals() method, but this can not take a SlashCommandBuilder as the argument. Is there a way to convert the SlashCommandBuilder into an appropriate object or is there some other way to achieve this comparison? (I then hope to extend this to a hotload scenario that utilizes a file system watcher)
16 replies
DIAdiscord.js - Imagine a boo! 👻
Created by The Fabulous Geek on 3/27/2024 in #djs-questions
Hot loading
Is it possible to hot load commands and event handlers?
6 replies