Yuuki | ユウキ
DIdiscord.js - Imagine ❄
•Created by Yuuki | ユウキ on 8/21/2023 in #djs-questions
Optimizing Image Processing, Storage, and Strategies to Prevent Alts and Botting: Seeking Advice
Hello everyone! I'm seeking insights on optimizing image processing for my application, focusing on simple image editing tasks like overlaying pictures. Currently, I'm using the Sharp package for this, but I'm open to considering other approaches. I would greatly appreciate any advice on the best practices for efficient image processing. I'm debating whether to store image links in my database or utilize a CDN, talking about thousands of images. If you have experience with either approach, I'd love to hear your insights. Additionally, I'm interested in recommendations for image storage providers with permanent links or CDN services. Lastly, I'm also interested in strategies to prevent botting and alting. Any tips or techniques to safeguard against such activities would be extremely helpful - thank you!
3 replies
DIdiscord.js - Imagine ❄
•Created by Yuuki | ユウキ on 7/30/2023 in #djs-questions
[CLOSED] Question regarding Unicode and Custom emojis
Hi! Anyone knows if discord.js offers a way to check if an emoji/string is a valid discord unicode emoji and not a custom one?
The only solution I found so far is by checking if this emoji map contains the emoji string: https://gist.github.com/Vexs/629488c4bb4126ad2a9909309ed6bd71
What is a better way to do this? Much love! <:Panda_Love:1116299125705687062>
9 replies
DIdiscord.js - Imagine ❄
•Created by Yuuki | ユウキ on 7/28/2023 in #djs-questions
[CLOSED] A question regarding discord.js with types. (TypeScript)
Hi! I'd have a question for the typescript users here. My commands can be run by the
InteractionCreate
and messageCreate
event as well. Let me try to explain it. Since they can be a normal text message(with a prefix) or a slash command as well I have to get the arguments the following way (using plain javascript): (This is because inter.options is not available when the interaction is a normal message)
Now with typescript: I destruct the arguments this way since they can be of type CommandInteraction
(when using InteractionCreate
) and of type Message
(when using messageCreate
) Now I can't get the argument the same way since inter.options
only exists on CommandInteraction and not Message
as well. So I have to check if the interaction is instanceof CommandInteraction
just to get the options property. "options" is declared this way in the discord.js module: Now typescript tells me that Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<CacheType>, "getMessage" | "getFocused" | "getMentionable" | "getRole" | "getAttachment" | ... 6 more ... | "getSubcommand">'
So I tried casting the inter.options property to type CommandInteractionOptionResolver
like this which works fine:
And you might already see where this goes.. Just getting an argument (while also handling normal and slash commands at the same time) the code looks like this: Here comes my question. Is there any other way of handling this so I can avoid all this work without setting the interaction to type any
? async execute({ inter, args }: { inter: any, args: string[] }) {
Many thanks!14 replies