@magicyan/discord 1.0.30 → 1.0.31

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.
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const discord_js = require('discord.js');
4
- const chars = require('../../constants/chars.cjs');
5
4
  const assets = require('./assets.cjs');
6
5
  const fields = require('./fields.cjs');
7
6
  const footer = require('./footer.cjs');
7
+ const chars = require('../../constants/chars.cjs');
8
8
 
9
9
  var __defProp = Object.defineProperty;
10
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -54,6 +54,10 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
54
54
  toString(space = 2) {
55
55
  return JSON.stringify(this, null, space);
56
56
  }
57
+ toAttachment(data = { name: "embed.png" }, space = 2) {
58
+ const buffer = Buffer.from(this.toString(space), "utf-8");
59
+ return new discord_js.AttachmentBuilder(buffer, data);
60
+ }
57
61
  setBorderColor(color) {
58
62
  if (color === null) {
59
63
  this.setColor("#2B2D31");
@@ -65,10 +69,32 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
65
69
  return this;
66
70
  }
67
71
  setAsset(asset, source) {
68
- if (source === null) {
69
- asset === "image" ? this.setImage(source) : this.setThumbnail(source);
70
- } else {
71
- this.update({ [asset]: source });
72
+ this.update({ [asset]: source });
73
+ return this;
74
+ }
75
+ setElementImageURL(element, url) {
76
+ switch (element) {
77
+ case "thumbnail":
78
+ case "image": {
79
+ this.setAsset(element, url);
80
+ break;
81
+ }
82
+ case "author": {
83
+ const author = this.data.author;
84
+ this.setAuthor({
85
+ name: author?.name ?? chars.chars.invisible,
86
+ iconURL: url ?? void 0
87
+ });
88
+ break;
89
+ }
90
+ case "footer": {
91
+ const footer = this.data.footer;
92
+ this.setFooter({
93
+ text: footer?.text ?? chars.chars.invisible,
94
+ iconURL: url ?? void 0
95
+ });
96
+ break;
97
+ }
72
98
  }
73
99
  return this;
74
100
  }
@@ -80,8 +106,8 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
80
106
  }
81
107
  }
82
108
  function createEmbed(options) {
83
- const { array = false, interaction, ...data } = options;
84
- const embed = interaction ? EmbedPlusBuilder.fromInteraction(interaction, 0, data) : new EmbedPlusBuilder(data);
109
+ const { array = false, from, fromIndex = 0, ...data } = options;
110
+ const embed = from ? "message" in from ? EmbedPlusBuilder.fromInteraction(from, fromIndex, data) : EmbedPlusBuilder.fromMessage(from, fromIndex, data) : new EmbedPlusBuilder(data);
85
111
  return array ? [embed] : embed;
86
112
  }
87
113
 
@@ -1,8 +1,8 @@
1
- import { EmbedBuilder } from 'discord.js';
2
- import { chars } from '../../constants/chars.mjs';
1
+ import { EmbedBuilder, AttachmentBuilder } from 'discord.js';
3
2
  import { createEmbedAsset } from './assets.mjs';
4
3
  import { EmbedPlusFields } from './fields.mjs';
5
4
  import { createEmbedFooter } from './footer.mjs';
5
+ import { chars } from '../../constants/chars.mjs';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -52,6 +52,10 @@ class EmbedPlusBuilder extends EmbedBuilder {
52
52
  toString(space = 2) {
53
53
  return JSON.stringify(this, null, space);
54
54
  }
55
+ toAttachment(data = { name: "embed.png" }, space = 2) {
56
+ const buffer = Buffer.from(this.toString(space), "utf-8");
57
+ return new AttachmentBuilder(buffer, data);
58
+ }
55
59
  setBorderColor(color) {
56
60
  if (color === null) {
57
61
  this.setColor("#2B2D31");
@@ -63,10 +67,32 @@ class EmbedPlusBuilder extends EmbedBuilder {
63
67
  return this;
64
68
  }
65
69
  setAsset(asset, source) {
66
- if (source === null) {
67
- asset === "image" ? this.setImage(source) : this.setThumbnail(source);
68
- } else {
69
- this.update({ [asset]: source });
70
+ this.update({ [asset]: source });
71
+ return this;
72
+ }
73
+ setElementImageURL(element, url) {
74
+ switch (element) {
75
+ case "thumbnail":
76
+ case "image": {
77
+ this.setAsset(element, url);
78
+ break;
79
+ }
80
+ case "author": {
81
+ const author = this.data.author;
82
+ this.setAuthor({
83
+ name: author?.name ?? chars.invisible,
84
+ iconURL: url ?? void 0
85
+ });
86
+ break;
87
+ }
88
+ case "footer": {
89
+ const footer = this.data.footer;
90
+ this.setFooter({
91
+ text: footer?.text ?? chars.invisible,
92
+ iconURL: url ?? void 0
93
+ });
94
+ break;
95
+ }
70
96
  }
71
97
  return this;
72
98
  }
@@ -78,8 +104,8 @@ class EmbedPlusBuilder extends EmbedBuilder {
78
104
  }
79
105
  }
80
106
  function createEmbed(options) {
81
- const { array = false, interaction, ...data } = options;
82
- const embed = interaction ? EmbedPlusBuilder.fromInteraction(interaction, 0, data) : new EmbedPlusBuilder(data);
107
+ const { array = false, from, fromIndex = 0, ...data } = options;
108
+ const embed = from ? "message" in from ? EmbedPlusBuilder.fromInteraction(from, fromIndex, data) : EmbedPlusBuilder.fromMessage(from, fromIndex, data) : new EmbedPlusBuilder(data);
83
109
  return array ? [embed] : embed;
84
110
  }
85
111
 
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const discord_js = require('discord.js');
4
+
5
+ function createEmbedFiles(embed, options) {
6
+ const { thumbnail, image, footer, author } = embed.data;
7
+ const files = [];
8
+ const handle = (url, name, ext = "png") => {
9
+ files.push(new discord_js.AttachmentBuilder(url, { name: `${name}.${ext}` }));
10
+ return `attachment://${name}.${ext}`;
11
+ };
12
+ if (thumbnail?.url) {
13
+ const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
14
+ embed.setThumbnail(url);
15
+ }
16
+ if (image?.url) {
17
+ const url = handle(image.url, "image", options?.extentions?.image);
18
+ embed.setImage(url);
19
+ }
20
+ if (author?.icon_url) {
21
+ const url = handle(author?.icon_url, "author", options?.extentions?.author);
22
+ embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
23
+ }
24
+ if (footer?.icon_url) {
25
+ const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
26
+ embed.setFooter({ text: footer.text, iconURL: url });
27
+ }
28
+ return files;
29
+ }
30
+
31
+ exports.createEmbedFiles = createEmbedFiles;
@@ -0,0 +1,29 @@
1
+ import { AttachmentBuilder } from 'discord.js';
2
+
3
+ function createEmbedFiles(embed, options) {
4
+ const { thumbnail, image, footer, author } = embed.data;
5
+ const files = [];
6
+ const handle = (url, name, ext = "png") => {
7
+ files.push(new AttachmentBuilder(url, { name: `${name}.${ext}` }));
8
+ return `attachment://${name}.${ext}`;
9
+ };
10
+ if (thumbnail?.url) {
11
+ const url = handle(thumbnail.url, "thumbnail", options?.extentions?.thumbnail);
12
+ embed.setThumbnail(url);
13
+ }
14
+ if (image?.url) {
15
+ const url = handle(image.url, "image", options?.extentions?.image);
16
+ embed.setImage(url);
17
+ }
18
+ if (author?.icon_url) {
19
+ const url = handle(author?.icon_url, "author", options?.extentions?.author);
20
+ embed.setAuthor({ name: author.name, iconURL: url, url: author.url });
21
+ }
22
+ if (footer?.icon_url) {
23
+ const url = handle(footer.icon_url, "footer", options?.extentions?.footer);
24
+ embed.setFooter({ text: footer.text, iconURL: url });
25
+ }
26
+ return files;
27
+ }
28
+
29
+ export { createEmbedFiles };
@@ -3,7 +3,9 @@
3
3
  const discord_js = require('discord.js');
4
4
 
5
5
  function setMobileStatus() {
6
- discord_js.DefaultWebSocketManagerOptions.identifyProperties.browser = "Discord Android";
6
+ Object.assign(discord_js.DefaultWebSocketManagerOptions.identifyProperties, {
7
+ browser: "Discord Android"
8
+ });
7
9
  }
8
10
 
9
11
  exports.setMobileStatus = setMobileStatus;
@@ -1,7 +1,9 @@
1
1
  import { DefaultWebSocketManagerOptions } from 'discord.js';
2
2
 
3
3
  function setMobileStatus() {
4
- DefaultWebSocketManagerOptions.identifyProperties.browser = "Discord Android";
4
+ Object.assign(DefaultWebSocketManagerOptions.identifyProperties, {
5
+ browser: "Discord Android"
6
+ });
5
7
  }
6
8
 
7
9
  export { setMobileStatus };
package/dist/index.cjs CHANGED
@@ -7,6 +7,7 @@ const assets = require('./functions/embeds/assets.cjs');
7
7
  const author = require('./functions/embeds/author.cjs');
8
8
  const embedplus = require('./functions/embeds/embedplus.cjs');
9
9
  const footer = require('./functions/embeds/footer.cjs');
10
+ const files = require('./functions/embeds/files.cjs');
10
11
  const components = require('./functions/components.cjs');
11
12
  const channels = require('./functions/channels.cjs');
12
13
  const commands = require('./functions/commands.cjs');
@@ -29,6 +30,7 @@ exports.createEmbedAuthor = author.createEmbedAuthor;
29
30
  exports.EmbedPlusBuilder = embedplus.EmbedPlusBuilder;
30
31
  exports.createEmbed = embedplus.createEmbed;
31
32
  exports.createEmbedFooter = footer.createEmbedFooter;
33
+ exports.createEmbedFiles = files.createEmbedFiles;
32
34
  exports.createLinkButton = components.createLinkButton;
33
35
  exports.createRow = components.createRow;
34
36
  exports.findChannel = channels.findChannel;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, ColorResolvable, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -132,19 +132,33 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
132
132
  has(property: keyof EmbedPlusData): boolean;
133
133
  toArray(): EmbedPlusBuilder[];
134
134
  toString(space?: number): string;
135
+ toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
135
136
  setBorderColor(color: EmbedPlusColorData | null): this;
136
137
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
138
+ setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
137
139
  static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
138
140
  static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
139
141
  }
140
142
  type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
141
143
  interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
142
144
  array?: B;
143
- interaction?: InteractionWithEmbeds;
145
+ from?: InteractionWithEmbeds | MessageWithEmbeds;
146
+ fromIndex?: number;
144
147
  }
145
148
  type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
146
149
  declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
147
150
 
151
+ type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
152
+ type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
153
+ interface CreateEmbedFilesOptions {
154
+ extentions?: Record<ImageElementProperty, ImageFileExtention>;
155
+ }
156
+ /**
157
+ *
158
+ * Turns any embed image url into an attachment and returns an attachment array
159
+ */
160
+ declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
161
+
148
162
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
149
163
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
150
164
  }
@@ -267,4 +281,4 @@ declare function findRole(guild: Guild): {
267
281
  */
268
282
  declare function extractMentionId(mention: string): string | null;
269
283
 
270
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
284
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, ColorResolvable, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -132,19 +132,33 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
132
132
  has(property: keyof EmbedPlusData): boolean;
133
133
  toArray(): EmbedPlusBuilder[];
134
134
  toString(space?: number): string;
135
+ toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
135
136
  setBorderColor(color: EmbedPlusColorData | null): this;
136
137
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
138
+ setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
137
139
  static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
138
140
  static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
139
141
  }
140
142
  type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
141
143
  interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
142
144
  array?: B;
143
- interaction?: InteractionWithEmbeds;
145
+ from?: InteractionWithEmbeds | MessageWithEmbeds;
146
+ fromIndex?: number;
144
147
  }
145
148
  type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
146
149
  declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
147
150
 
151
+ type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
152
+ type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
153
+ interface CreateEmbedFilesOptions {
154
+ extentions?: Record<ImageElementProperty, ImageFileExtention>;
155
+ }
156
+ /**
157
+ *
158
+ * Turns any embed image url into an attachment and returns an attachment array
159
+ */
160
+ declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
161
+
148
162
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
149
163
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
150
164
  }
@@ -267,4 +281,4 @@ declare function findRole(guild: Guild): {
267
281
  */
268
282
  declare function extractMentionId(mention: string): string | null;
269
283
 
270
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
284
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, ColorResolvable, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitFields, Collection, TextInputComponent, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -132,19 +132,33 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
132
132
  has(property: keyof EmbedPlusData): boolean;
133
133
  toArray(): EmbedPlusBuilder[];
134
134
  toString(space?: number): string;
135
+ toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
135
136
  setBorderColor(color: EmbedPlusColorData | null): this;
136
137
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
138
+ setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
137
139
  static fromInteraction(interaction: InteractionWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
138
140
  static fromMessage(message: MessageWithEmbeds, index?: number, data?: EmbedPlusData): EmbedPlusBuilder;
139
141
  }
140
142
  type EmbedPlusProperty<P extends keyof EmbedPlusData> = EmbedPlusData[P];
141
143
  interface CreateEmbedOptions<B extends boolean> extends EmbedPlusOptions {
142
144
  array?: B;
143
- interaction?: InteractionWithEmbeds;
145
+ from?: InteractionWithEmbeds | MessageWithEmbeds;
146
+ fromIndex?: number;
144
147
  }
145
148
  type CreateEmbedReturn<B> = undefined extends B ? EmbedPlusBuilder : false extends B ? EmbedPlusBuilder : EmbedPlusBuilder[];
146
149
  declare function createEmbed<B extends boolean>(options: CreateEmbedOptions<B>): CreateEmbedReturn<B>;
147
150
 
151
+ type ImageFileExtention = "png" | "jpg" | "gif" | "webp";
152
+ type ImageElementProperty = "author" | "thumbnail" | "image" | "footer";
153
+ interface CreateEmbedFilesOptions {
154
+ extentions?: Record<ImageElementProperty, ImageFileExtention>;
155
+ }
156
+ /**
157
+ *
158
+ * Turns any embed image url into an attachment and returns an attachment array
159
+ */
160
+ declare function createEmbedFiles(embed: EmbedPlusBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
161
+
148
162
  declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
149
163
  interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
150
164
  }
@@ -267,4 +281,4 @@ declare function findRole(guild: Guild): {
267
281
  */
268
282
  declare function extractMentionId(mention: string): string | null;
269
283
 
270
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, EmbedPlusBuilder, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
284
+ export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
package/dist/index.mjs CHANGED
@@ -5,6 +5,7 @@ export { createEmbedAsset } from './functions/embeds/assets.mjs';
5
5
  export { createEmbedAuthor } from './functions/embeds/author.mjs';
6
6
  export { EmbedPlusBuilder, createEmbed } from './functions/embeds/embedplus.mjs';
7
7
  export { createEmbedFooter } from './functions/embeds/footer.mjs';
8
+ export { createEmbedFiles } from './functions/embeds/files.mjs';
8
9
  export { createLinkButton, createRow } from './functions/components.mjs';
9
10
  export { findChannel, getChannelUrlInfo } from './functions/channels.mjs';
10
11
  export { findCommand } from './functions/commands.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicyan/discord",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Simple functions to facilitate discord bot development",
5
5
  "license": "MIT",
6
6
  "type": "module",