Skip to content

Commit

Permalink
fix: update allowedmentions parse type (#203)
Browse files Browse the repository at this point in the history
* fix: update parse type

* chore: update contributing link

* Add test command to Rocko

* Pass allowedMentions to discord as allowed_mentions

* chore: add changeset
  • Loading branch information
FinnyMarigold58 authored Oct 27, 2024
1 parent e20d29c commit d5d1488
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-gifts-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@buape/carbon": patch
---

fix: send allowedMentions to discord in correct format
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
11 changes: 11 additions & 0 deletions apps/rocko/src/commands/testing/allow_mentions.ts
Original file line number Diff line number Diff line change
@@ -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: []}})
}
}
4 changes: 3 additions & 1 deletion apps/rocko/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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, {
Expand Down
2 changes: 1 addition & 1 deletion packages/carbon/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
}
Expand Down
1 change: 1 addition & 0 deletions packages/carbon/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit d5d1488

Please sign in to comment.