You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As it currently stands, we have a multitude of different overloads for our .send([content], [options]) methods. Some of which are just confusing and lead to all kinds of problems that are not intended in the first place:
channel.send('Hello World 👋');channel.send(embed,{embed: embed});channel.send([embed,embed2])// ??? Normal messages cannot even consist of two embeds so only the first one is being sentchannel.send([attachment,attachment2]);channel.send(attachment,{files: [attachment]});// ???channel.send(embed,{content: 'Hello World 👋'});channel.send('Hello World 👋',{embed: embed});webhook.send('Hello World 👋',{embeds: [embed]});webhook.send({embeds: [embed,embed2]});webhook.send([embed,embed2]);// Here it works because webhooks do allow you to send multiple embedswebhook.send([attachment,attachment2]);webhook.send(attachment,{files: [attachment]});// ???
This gets even more complicated now once we start working with interactions and can send normal messages as we can send webhook messages:
interaction.send('Hello World 👋',{ephemeral: true,embeds: [embed],components: [row]});interaction.send({content: 'Hello World 👋',embeds: [embed],components: [row]});interaction.send(embed,{content: 'Hello World 👋',components: [row]});// But we can send multiple embeds right?interaction.send([embed,embed2],{content: 'Hello World 👋',components: [row]});// I can not 100% confirm, but I would not be surprised if this works
Describe the ideal solution
The ideal solution to this would be to have a nice and conform interface that allows a certain amount of strictness yet enough flexibility to cover the most used use-cases without having a high maintenance cost or confusing syntax:
channel.send('Hello World 👋');channel.send({embed: embed});// For the sake of explicitness, but this can obviously be `{ embed } as a shorthand`channel.send({files: [attachment]});channel.send({files: [attachment,attachment2]});channel.send({content: 'Hello World 👋',embed: embed});webhook.send('Hello World 👋');webhook.send({content: 'Hello World 👋',embeds: [embed]});webhook.send({embeds: [embed1,embed2]});webhook.send({files: [attachment]});webhook.send({files: [attachment,attachment2]});interaction.send('Hello World 👋');interaction.send({content: 'Hello World 👋',embeds: [embed]});interaction.send({embeds: [embed]});interaction.send({embeds: [embed,embed2]});
Describe alternatives you've considered
I had some thoughts about doing something like allowing:
channel.send(embed);channel.send(attachment);
While the former is completely in line with how bots can send only one embed to a TextChannel, there is a huge problem with the second one since bots can send multiple attachments.
Going back to how we did it before (as seen in the first code block) is a bit problematic since it is ambiguous, provides too much flexibility and is confusing. It opens a whole assortment of problems as to why we would allow it for embeds on webhooks, but not on TextChannels.
Edit:
I also briefly thought about allowing some spread syntax:
Is your feature request related to a problem? Please describe.
As it currently stands, we have a multitude of different overloads for our
.send([content], [options])
methods. Some of which are just confusing and lead to all kinds of problems that are not intended in the first place:This gets even more complicated now once we start working with interactions and can send normal messages as we can send webhook messages:
Describe the ideal solution
The ideal solution to this would be to have a nice and conform interface that allows a certain amount of strictness yet enough flexibility to cover the most used use-cases without having a high maintenance cost or confusing syntax:
Describe alternatives you've considered
I had some thoughts about doing something like allowing:
While the former is completely in line with how bots can send only one embed to a
TextChannel
, there is a huge problem with the second one since bots can send multiple attachments.Going back to how we did it before (as seen in the first code block) is a bit problematic since it is ambiguous, provides too much flexibility and is confusing. It opens a whole assortment of problems as to why we would allow it for
embeds
on webhooks, but not onTextChannels
.Edit:
It is less of a problem when sending only two attachments, as we can do surely do:
But the moment you want to add more than just attachments you have to refactor your whole code to:
While if we make the changes proposed this would not have to happen, since the only allowed method would be:
The text was updated successfully, but these errors were encountered: