Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: allow builders to accept emoji strings (#7616)
* refactor: allow emoji strings in button builder * refactor: add emoji string support for select menu options * fix: export select menu option * chore: make requested changes * Update packages/discord.js/typings/index.test-d.ts Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
- Loading branch information
1 parent
daf2829
commit fb9a9c2
Showing
7 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/discord.js/src/structures/SelectMenuOptionBuilder.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const { SelectMenuOptionBuilder: BuildersSelectMenuOption } = require('@discordjs/builders'); | ||
const Util = require('../util/Util'); | ||
|
||
/** | ||
* Represents a select menu option | ||
*/ | ||
class SelectMenuOptionBuilder extends BuildersSelectMenuOption { | ||
/** | ||
* Sets the emoji to display on this option | ||
* @param {ComponentEmojiResolvable} emoji The emoji to display on this option | ||
* @returns {SelectMenuOptionBuilder} | ||
*/ | ||
setEmoji(emoji) { | ||
if (typeof emoji === 'string') { | ||
return super.setEmoji(Util.parseEmoji(emoji)); | ||
} | ||
return super.setEmoji(emoji); | ||
} | ||
} | ||
|
||
module.exports = SelectMenuOptionBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters