Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: buape/carbon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b49bc8a74a5c9657a432182e80f9defca79189b7
Choose a base ref
..
head repository: buape/carbon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2b130a9d43932741f1779986ed38251e3c4c53d7
Choose a head ref
Showing with 22 additions and 3 deletions.
  1. +5 −0 .changeset/violet-gifts-yawn.md
  2. +1 −1 README.md
  3. +11 −0 apps/rocko/src/commands/testing/allow_mentions.ts
  4. +3 −1 apps/rocko/src/index.ts
  5. +1 −1 packages/carbon/src/types.ts
  6. +1 −0 packages/carbon/src/utils.ts
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
@@ -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
@@ -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, {
2 changes: 1 addition & 1 deletion packages/carbon/src/types.ts
Original file line number Diff line number Diff line change
@@ -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[]
}
1 change: 1 addition & 0 deletions packages/carbon/src/utils.ts
Original file line number Diff line number Diff line change
@@ -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())
}