discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
977 stars 236 forks source link

Embeds can't have 2 fields with the same name #1142

Closed 1PV1 closed 1 year ago

1PV1 commented 1 year ago

Environment

Describe the bug Embeds can't have 2 fields with the same name because fields in an embed is a collection, we should be able to create multiple fields with the same name (\u{200b} for example). A good solution would be to make fields an array.

To Reproduce Steps to reproduce the behavior:

// Has one field
print_r((new Embed($discord))->setColor(0xffffff)->addField(...[[ "name" => "\u{200b}", 'value' => "\u{200b}", "inline" => false ], [ "name" => "\u{200b}", 'value' => "\u{200b}", "inline" => false ]]));

// Has two fields
print_r((new Embed($discord))->setColor(0xffffff)->addField(...[[ "name" => "\u{200b}", 'value' => "\u{200b}", "inline" => false ], [ "name" => "test", 'value' => "\u{200b}", "inline" => false ]]));
key2peace commented 1 year ago

This limit is on the discord side, we do not check for duplicate names. Code reference

key2peace commented 1 year ago

actually looking at this now..

SQKo commented 1 year ago

Thanks for reporting, should be fixed in dev-master#9fab769