@magicyan/discord 1.2.0 → 1.2.1
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/dist/functions/embeds/assets.cjs +2 -2
- package/dist/functions/embeds/assets.mjs +2 -2
- package/dist/functions/embeds/author.cjs +1 -1
- package/dist/functions/embeds/author.mjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/package.json +2 -2
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const discord_js = require('discord.js');
|
|
4
4
|
|
|
5
|
-
function createEmbedAsset(source, options) {
|
|
5
|
+
function createEmbedAsset(source, options = {}) {
|
|
6
6
|
if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
|
|
7
7
|
return { url: `attachment://${source.name}`, ...options };
|
|
8
8
|
}
|
|
9
9
|
if (source && typeof source === "object" && "url" in source) {
|
|
10
|
-
return Object.assign(source, options
|
|
10
|
+
return Object.assign(source, options);
|
|
11
11
|
}
|
|
12
12
|
return source ? Object.assign({ url: source }, options) : void 0;
|
|
13
13
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Attachment, AttachmentBuilder } from 'discord.js';
|
|
2
2
|
|
|
3
|
-
function createEmbedAsset(source, options) {
|
|
3
|
+
function createEmbedAsset(source, options = {}) {
|
|
4
4
|
if (source instanceof Attachment || source instanceof AttachmentBuilder) {
|
|
5
5
|
return { url: `attachment://${source.name}`, ...options };
|
|
6
6
|
}
|
|
7
7
|
if (source && typeof source === "object" && "url" in source) {
|
|
8
|
-
return Object.assign(source, options
|
|
8
|
+
return Object.assign(source, options);
|
|
9
9
|
}
|
|
10
10
|
return source ? Object.assign({ url: source }, options) : void 0;
|
|
11
11
|
}
|
|
@@ -27,7 +27,7 @@ function createEmbedAuthor(type, options) {
|
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
return { name: `${prefix}${name}${suffix}`, url: url
|
|
30
|
+
return { name: `${prefix}${name}${suffix}`, url: url?.toString(), iconURL };
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
exports.createEmbedAuthor = createEmbedAuthor;
|
|
@@ -25,7 +25,7 @@ function createEmbedAuthor(type, options) {
|
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
return { name: `${prefix}${name}${suffix}`, url: url
|
|
28
|
+
return { name: `${prefix}${name}${suffix}`, url: url?.toString(), iconURL };
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export { createEmbedAuthor };
|
package/dist/index.d.cts
CHANGED
|
@@ -22,13 +22,14 @@ type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetDa
|
|
|
22
22
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
23
23
|
declare function createEmbedAsset(source: EmbedPlusAssetData, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
24
24
|
|
|
25
|
+
type IdentityProperty = "username" | "displayName" | "id" | "globalName" | "nickname";
|
|
25
26
|
interface MemberAuthor {
|
|
26
27
|
type: GuildMember;
|
|
27
|
-
property?:
|
|
28
|
+
property?: IdentityProperty;
|
|
28
29
|
}
|
|
29
30
|
interface UserAuthor {
|
|
30
31
|
type: User | ClientUser;
|
|
31
|
-
property?:
|
|
32
|
+
property?: Exclude<IdentityProperty, "nickname">;
|
|
32
33
|
}
|
|
33
34
|
interface GuildAuthor {
|
|
34
35
|
type: Guild;
|
package/dist/index.d.mts
CHANGED
|
@@ -22,13 +22,14 @@ type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetDa
|
|
|
22
22
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
23
23
|
declare function createEmbedAsset(source: EmbedPlusAssetData, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
24
24
|
|
|
25
|
+
type IdentityProperty = "username" | "displayName" | "id" | "globalName" | "nickname";
|
|
25
26
|
interface MemberAuthor {
|
|
26
27
|
type: GuildMember;
|
|
27
|
-
property?:
|
|
28
|
+
property?: IdentityProperty;
|
|
28
29
|
}
|
|
29
30
|
interface UserAuthor {
|
|
30
31
|
type: User | ClientUser;
|
|
31
|
-
property?:
|
|
32
|
+
property?: Exclude<IdentityProperty, "nickname">;
|
|
32
33
|
}
|
|
33
34
|
interface GuildAuthor {
|
|
34
35
|
type: Guild;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,13 +22,14 @@ type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetDa
|
|
|
22
22
|
type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
|
|
23
23
|
declare function createEmbedAsset(source: EmbedPlusAssetData, options?: EmbedAssetOptions): EmbedAssetData | undefined;
|
|
24
24
|
|
|
25
|
+
type IdentityProperty = "username" | "displayName" | "id" | "globalName" | "nickname";
|
|
25
26
|
interface MemberAuthor {
|
|
26
27
|
type: GuildMember;
|
|
27
|
-
property?:
|
|
28
|
+
property?: IdentityProperty;
|
|
28
29
|
}
|
|
29
30
|
interface UserAuthor {
|
|
30
31
|
type: User | ClientUser;
|
|
31
|
-
property?:
|
|
32
|
+
property?: Exclude<IdentityProperty, "nickname">;
|
|
32
33
|
}
|
|
33
34
|
interface GuildAuthor {
|
|
34
35
|
type: Guild;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicyan/discord",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Simple functions to facilitate discord bot development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"unbuild": "^2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@magicyan/core": "^1.0.
|
|
42
|
+
"@magicyan/core": "^1.0.20"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"discord.js": "^14.16.3"
|