@ovencord/builders 1.11.8 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@ovencord/builders",
4
- "version": "1.11.8",
4
+ "version": "1.12.0",
5
5
  "description": "A set of builders that you can use when creating your bot",
6
6
  "scripts": {
7
7
  "test": "bun test",
@@ -57,7 +57,9 @@ export const sectionPredicate = z.object({
57
57
  id: idPredicate,
58
58
  components: z.array(textDisplayPredicate).min(1).max(3),
59
59
  accessory: z.union([
60
- buttonPredicate,
60
+ buttonPredicate.refine((data) => 'label' in data && data.label !== undefined, {
61
+ message: 'Buttons used as section accessories must have a label.',
62
+ }),
61
63
  thumbnailPredicate,
62
64
  ]),
63
65
  });
@@ -266,6 +266,15 @@ export class SectionBuilder extends ComponentBuilder<APISectionComponent> {
266
266
  const { components, accessory, ...rest } = this.data;
267
267
 
268
268
  // Resolve accessory if it exists
269
+ if (accessory) {
270
+ console.log("DEBUG: Section.toJSON accessory:", accessory);
271
+ console.log("DEBUG: Constructor:", (accessory as any).constructor.name);
272
+ console.log("DEBUG: Has toJSON?", 'toJSON' in accessory);
273
+ if ('toJSON' in accessory) {
274
+ console.log("DEBUG: calling toJSON result:", (accessory as any).toJSON(validationOverride));
275
+ }
276
+ }
277
+
269
278
  const accessoryData = accessory
270
279
  ? (accessory as any).toJSON
271
280
  ? (accessory as any).toJSON(validationOverride)
@@ -11,7 +11,7 @@ import type { APIMessageComponentEmoji } from 'discord-api-types/v10';
11
11
  */
12
12
  export function parseEmoji(text: string): APIMessageComponentEmoji {
13
13
  const decodedText = text.includes('%') ? decodeURIComponent(text) : text;
14
- if (!decodedText.includes(':')) return { animated: false, name: decodedText, id: undefined };
14
+ if (!decodedText.includes(':')) return { animated: false, name: decodedText.replace(/\uFE0F/g, ''), id: undefined };
15
15
  const match = /<?(?:(?<animated>a):)?(?<name>\w{2,32}):(?<id>\d{17,19})?>?/.exec(decodedText);
16
16
 
17
17
  if (!match || !match.groups) {