diff --git a/.changeset/violet-gifts-yawn.md b/.changeset/violet-gifts-yawn.md new file mode 100644 index 00000000..f9b6b401 --- /dev/null +++ b/.changeset/violet-gifts-yawn.md @@ -0,0 +1,5 @@ +--- +"@buape/carbon": patch +--- + +fix: send allowedMentions to discord in correct format diff --git a/README.md b/README.md index 32902004..8eaa9ede 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ To get started with Carbon, you can check out the [Getting Started](https://carb ## Contributing -We welcome contributions to Carbon! If you're interested in contributing, please check out the [Contributing Guide](https://carbon.buape.com/carbon/helpful-guides/contributing) for more information, and join our [Discord](https://go.buape.com/carbon) to get involved! +We welcome contributions to Carbon! If you're interested in contributing, please check out the [Contributing Guide](https://carbon.buape.com/even-more/contributing) for more information, and join our [Discord](https://go.buape.com/carbon) to get involved! diff --git a/apps/rocko/src/commands/testing/allow_mentions.ts b/apps/rocko/src/commands/testing/allow_mentions.ts new file mode 100644 index 00000000..3eeb84eb --- /dev/null +++ b/apps/rocko/src/commands/testing/allow_mentions.ts @@ -0,0 +1,11 @@ +import { Command, CommandInteraction } from "@buape/carbon"; + +export default class MentionsCommand extends Command { + name = "mention" + description = "Allowed Mentions Test" + defer = true + + async run(interaction: CommandInteraction) { + await interaction.reply({content: `<@${interaction.userId}>`, allowedMentions: {parse: []}}) + } +} \ No newline at end of file diff --git a/apps/rocko/src/index.ts b/apps/rocko/src/index.ts index 3d88f5af..8853518f 100644 --- a/apps/rocko/src/index.ts +++ b/apps/rocko/src/index.ts @@ -16,6 +16,7 @@ import OptionsCommand from "./commands/testing/options.js" import SubcommandsCommand from "./commands/testing/subcommand.js" import SubcommandGroupsCommand from "./commands/testing/subcommandgroup.js" import UserCommand from "./commands/testing/user_command.js" +import MentionsCommand from "./commands/testing/allow_mentions.js" const handle = createHandle((env) => { const client = new Client( @@ -40,7 +41,8 @@ const handle = createHandle((env) => { new OptionsCommand(), new SubcommandsCommand(), new SubcommandGroupsCommand(), - new UserCommand() + new UserCommand(), + new MentionsCommand() ] ) const linkedRoles = new LinkedRoles(client, { diff --git a/packages/carbon/src/types.ts b/packages/carbon/src/types.ts index 34bdde0f..6365cca0 100644 --- a/packages/carbon/src/types.ts +++ b/packages/carbon/src/types.ts @@ -23,7 +23,7 @@ export type MessagePayload = * The settings for which mentions are allowed in the message */ allowedMentions?: { - parse?: ["roles", "users", "everyone"] + parse?: ("roles" | "users" | "everyone")[] roles?: string[] users?: string[] } diff --git a/packages/carbon/src/utils.ts b/packages/carbon/src/utils.ts index 786e6208..916d00c9 100644 --- a/packages/carbon/src/utils.ts +++ b/packages/carbon/src/utils.ts @@ -89,6 +89,7 @@ export const serializePayload = ( } const data = { ...payload, + allowed_mentions: payload.allowedMentions, embeds: payload.embeds?.map((embed) => embed.serialize()), components: payload.components?.map((row) => row.serialize()) }