Wawajabba
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 1/12/2024 in #djs-questions
Add an image buffer as an attachment to an embed
discordjs 14.6.0, nodejs 18.15.0
I'm trying to use a buffer to attach an image to an embed, and I have no clue how I'm supposed to do it. I keep getting different errors, and I might just be an idiot, but the docs don't provide any insight into how I should do this either. The buffer, embed and message aren't the problem. I can save the image to a file or edit the embed into the message without adding the image.
Parts of the error that might be relevant:
validator: 's.nullish',
given: 'attachment://SPOILER_Example Name.png'
...
constraint: 's.string.url',
given: 'attachment://SPOILER_Example Name.png',
expected: 'expected to match an URL'
It appears the url is rejected, but I don't really know what url to provide other than the attachment name. Am I doing something obvious wrong?
12 replies
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 6/29/2023 in #djs-questions
Fetch messages older than certain date
I'd like to fetch the most recent messages from a channel that are older than a specific timestamp. E.g. if my limit is 5 days, I want the most recent messages that are at least 5 days old. I noticed the
FetchMessagesOptions
object has the before
parameter, but it works with a specific message ID, not a timestamp.
Do I first need to get the oldest message that is less than 5 days old, and then use that message's ID as the before
value? Because I'm not sure how I could do this efficiently without unnecessary API requests. Or is there a better way?4 replies
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 6/12/2023 in #djs-questions
How will djs handle bot tags, since they're not switching to the new username system?
I read on the Discord dev server that they decided not to switch bot users over to the new username system (yet), and they abandoned the idea to give all unverified bots a random username for now.
Does this mean .tag can still be used for bot users? Two systems being used at the same time confuses me, because it seems we'll have to continue using deprecated features to show the differences between bot usernames. So can .tag and .discriminator still be used for bot users, or will .globalname function like .tag does for bot users?
12 replies
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 6/5/2023 in #djs-questions
Does anyone know this "ENOTFOUND" error?
9 replies
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 12/19/2022 in #djs-questions
How far back does Message.delete() work?
I want to create a purge command that can go past the two week limit of bulk delete. I would do so by fetching the last 100 messages, and deleting them in groups of 5 in intervals of 6 seconds. Does Message.delete() have any constraints I should know of that would prevent this from working?
It's a private bot, on a private server. I'll respect the ratelimits.
5 replies
DIAdiscord.js - Imagine an app
•Created by Wawajabba on 11/4/2022 in #djs-questions
Bot crashed because of message with no 'guild' property
My bot crashed on a messageCreate event and I don't really understand why. I filter out DM messages, and then check message.guild.id because my bot is made for two specific servers. However, 'guild' was null so I got a TypeError when trying to access 'id'.
My code looks something like this:
The only thing that changed is that recently I switched from using Heroku to a server specifically for the bot. Heroku restarted the bot on a daily basis, this server doesn't. This happened after ~3 days of uninterrupted runtime, could that be related? Or is there a channel type (which bots can participate in) that isn't DMs but that also doesn't have a guild property?
10 replies