tweak and infer return type

This commit is contained in:
Crawron
2022-07-21 16:14:55 -05:00
committed by Darius
parent 33bb2ee196
commit 90744ebe47

View File

@@ -334,17 +334,15 @@ function convertButtonStyleToEnum(style: MessageButtonOptions["style"]) {
// TODO: this could be a part of the core library, // TODO: this could be a part of the core library,
// and also handle some edge cases, e.g. empty messages // and also handle some edge cases, e.g. empty messages
function getDiscordMessageOptions( function getDiscordMessageOptions(reacordOptions: MessageOptions) {
reacordOptions: MessageOptions, const options = {
): Discord.MessageOptions {
const options: Discord.MessageOptions = {
// eslint-disable-next-line unicorn/no-null // eslint-disable-next-line unicorn/no-null
content: reacordOptions.content || null, content: reacordOptions.content || null,
embeds: reacordOptions.embeds, embeds: reacordOptions.embeds,
components: reacordOptions.actionRows.map((row) => ({ components: reacordOptions.actionRows.map((row) => ({
type: Discord.ComponentType.ActionRow, type: Discord.ComponentType.ActionRow,
components: row.map( components: row.map(
(component): Discord.MessageActionRowComponentOptions => { (component): Discord.MessageActionRowComponentData => {
if (component.type === "button") { if (component.type === "button") {
return { return {
type: Discord.ComponentType.Button, type: Discord.ComponentType.Button,