@magicyan/discord 1.2.2 → 1.3.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/README.md +0 -1
- package/dist/constants/client.cjs +5 -5
- package/dist/constants/client.mjs +5 -5
- package/dist/functions/embeds/embedplus.cjs +14 -4
- package/dist/functions/embeds/embedplus.mjs +14 -4
- package/dist/functions/embeds/footer.cjs +1 -2
- package/dist/functions/embeds/footer.mjs +1 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +54 -47
package/README.md
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
const discord_js = require('discord.js');
|
|
4
4
|
|
|
5
5
|
const Messages = [
|
|
6
|
+
discord_js.IntentsBitField.Flags.DirectMessagePolls,
|
|
7
|
+
discord_js.IntentsBitField.Flags.DirectMessageReactions,
|
|
8
|
+
discord_js.IntentsBitField.Flags.DirectMessageTyping,
|
|
6
9
|
discord_js.IntentsBitField.Flags.MessageContent,
|
|
7
10
|
discord_js.IntentsBitField.Flags.GuildMessages,
|
|
8
11
|
discord_js.IntentsBitField.Flags.GuildMessageReactions,
|
|
9
|
-
discord_js.IntentsBitField.Flags.GuildMessageTyping
|
|
10
|
-
discord_js.IntentsBitField.Flags.DirectMessages,
|
|
11
|
-
discord_js.IntentsBitField.Flags.DirectMessageReactions,
|
|
12
|
-
discord_js.IntentsBitField.Flags.DirectMessageTyping
|
|
12
|
+
discord_js.IntentsBitField.Flags.GuildMessageTyping
|
|
13
13
|
];
|
|
14
14
|
const Guild = [
|
|
15
|
-
discord_js.IntentsBitField.Flags.
|
|
15
|
+
discord_js.IntentsBitField.Flags.GuildExpressions,
|
|
16
16
|
discord_js.IntentsBitField.Flags.GuildIntegrations,
|
|
17
17
|
discord_js.IntentsBitField.Flags.GuildInvites,
|
|
18
18
|
discord_js.IntentsBitField.Flags.GuildMembers,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { IntentsBitField, Partials } from 'discord.js';
|
|
2
2
|
|
|
3
3
|
const Messages = [
|
|
4
|
+
IntentsBitField.Flags.DirectMessagePolls,
|
|
5
|
+
IntentsBitField.Flags.DirectMessageReactions,
|
|
6
|
+
IntentsBitField.Flags.DirectMessageTyping,
|
|
4
7
|
IntentsBitField.Flags.MessageContent,
|
|
5
8
|
IntentsBitField.Flags.GuildMessages,
|
|
6
9
|
IntentsBitField.Flags.GuildMessageReactions,
|
|
7
|
-
IntentsBitField.Flags.GuildMessageTyping
|
|
8
|
-
IntentsBitField.Flags.DirectMessages,
|
|
9
|
-
IntentsBitField.Flags.DirectMessageReactions,
|
|
10
|
-
IntentsBitField.Flags.DirectMessageTyping
|
|
10
|
+
IntentsBitField.Flags.GuildMessageTyping
|
|
11
11
|
];
|
|
12
12
|
const Guild = [
|
|
13
|
-
IntentsBitField.Flags.
|
|
13
|
+
IntentsBitField.Flags.GuildExpressions,
|
|
14
14
|
IntentsBitField.Flags.GuildIntegrations,
|
|
15
15
|
IntentsBitField.Flags.GuildInvites,
|
|
16
16
|
IntentsBitField.Flags.GuildMembers,
|
|
@@ -57,20 +57,30 @@ class EmbedPlusBuilder extends discord_js.EmbedBuilder {
|
|
|
57
57
|
toString(space = 2) {
|
|
58
58
|
return JSON.stringify(this, null, space);
|
|
59
59
|
}
|
|
60
|
-
toAttachment(data = { name: "embed.
|
|
60
|
+
toAttachment(data = { name: "embed.json" }, space = 2) {
|
|
61
61
|
const buffer = Buffer.from(this.toString(space), "utf-8");
|
|
62
62
|
return new discord_js.AttachmentBuilder(buffer, data);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
setColor(color) {
|
|
65
65
|
if (color === null) {
|
|
66
|
-
|
|
66
|
+
super.setColor(colors.colors.embedbg);
|
|
67
67
|
} else if (typeof color === "number") {
|
|
68
68
|
this.update({ color });
|
|
69
69
|
} else {
|
|
70
|
-
|
|
70
|
+
super.setColor(color);
|
|
71
71
|
}
|
|
72
72
|
return this;
|
|
73
73
|
}
|
|
74
|
+
// public setBorderColor(color: EmbedPlusColorData | null): this {
|
|
75
|
+
// if (color === null){
|
|
76
|
+
// this.setColor(colors.embedbg as ColorResolvable);
|
|
77
|
+
// } else if (typeof color === "number"){
|
|
78
|
+
// this.update({ color });
|
|
79
|
+
// } else {
|
|
80
|
+
// this.setColor(color as ColorResolvable);
|
|
81
|
+
// }
|
|
82
|
+
// return this;
|
|
83
|
+
// }
|
|
74
84
|
setAsset(asset, source) {
|
|
75
85
|
this.update({ [asset]: source });
|
|
76
86
|
return this;
|
|
@@ -55,20 +55,30 @@ class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
55
55
|
toString(space = 2) {
|
|
56
56
|
return JSON.stringify(this, null, space);
|
|
57
57
|
}
|
|
58
|
-
toAttachment(data = { name: "embed.
|
|
58
|
+
toAttachment(data = { name: "embed.json" }, space = 2) {
|
|
59
59
|
const buffer = Buffer.from(this.toString(space), "utf-8");
|
|
60
60
|
return new AttachmentBuilder(buffer, data);
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
setColor(color) {
|
|
63
63
|
if (color === null) {
|
|
64
|
-
|
|
64
|
+
super.setColor(colors.embedbg);
|
|
65
65
|
} else if (typeof color === "number") {
|
|
66
66
|
this.update({ color });
|
|
67
67
|
} else {
|
|
68
|
-
|
|
68
|
+
super.setColor(color);
|
|
69
69
|
}
|
|
70
70
|
return this;
|
|
71
71
|
}
|
|
72
|
+
// public setBorderColor(color: EmbedPlusColorData | null): this {
|
|
73
|
+
// if (color === null){
|
|
74
|
+
// this.setColor(colors.embedbg as ColorResolvable);
|
|
75
|
+
// } else if (typeof color === "number"){
|
|
76
|
+
// this.update({ color });
|
|
77
|
+
// } else {
|
|
78
|
+
// this.setColor(color as ColorResolvable);
|
|
79
|
+
// }
|
|
80
|
+
// return this;
|
|
81
|
+
// }
|
|
72
82
|
setAsset(asset, source) {
|
|
73
83
|
this.update({ [asset]: source });
|
|
74
84
|
return this;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const core = require('@magicyan/core');
|
|
4
3
|
const chars = require('../../constants/chars.cjs');
|
|
5
4
|
|
|
6
5
|
function createEmbedFooter(options) {
|
|
7
6
|
const { text, iconURL } = options;
|
|
8
|
-
return !text && !iconURL ? void 0 : { text: text || chars.chars.invisible, iconURL:
|
|
7
|
+
return !text && !iconURL ? void 0 : { text: text || chars.chars.invisible, iconURL: iconURL || void 0 };
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
exports.createEmbedFooter = createEmbedFooter;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { notFound } from '@magicyan/core';
|
|
2
1
|
import { chars } from '../../constants/chars.mjs';
|
|
3
2
|
|
|
4
3
|
function createEmbedFooter(options) {
|
|
5
4
|
const { text, iconURL } = options;
|
|
6
|
-
return !text && !iconURL ? void 0 : { text: text || chars.invisible, iconURL:
|
|
5
|
+
return !text && !iconURL ? void 0 : { text: text || chars.invisible, iconURL: iconURL || void 0 };
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
export { createEmbedFooter };
|
package/dist/index.d.cts
CHANGED
|
@@ -154,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
154
154
|
toArray(): EmbedPlusBuilder[];
|
|
155
155
|
toString(space?: number): string;
|
|
156
156
|
toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
|
|
157
|
-
|
|
157
|
+
setColor(color: ColorResolvable | null): this;
|
|
158
158
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
159
159
|
setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
|
|
160
160
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -154,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
154
154
|
toArray(): EmbedPlusBuilder[];
|
|
155
155
|
toString(space?: number): string;
|
|
156
156
|
toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
|
|
157
|
-
|
|
157
|
+
setColor(color: ColorResolvable | null): this;
|
|
158
158
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
159
159
|
setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
|
|
160
160
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
|
|
|
154
154
|
toArray(): EmbedPlusBuilder[];
|
|
155
155
|
toString(space?: number): string;
|
|
156
156
|
toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
|
|
157
|
-
|
|
157
|
+
setColor(color: ColorResolvable | null): this;
|
|
158
158
|
setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
|
|
159
159
|
setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
|
|
160
160
|
}
|
package/package.json
CHANGED
|
@@ -1,47 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"dist"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@magicyan/discord",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Simple functions to facilitate discord bot development",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/rinckodev/magicyan",
|
|
13
|
+
"directory": "packages/discord"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"url": "https://github.com/rinckodev",
|
|
17
|
+
"name": "Rincko Dev"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/rinckodev/magicyan/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/rinckodev/magicyan/tree/main/packages/discord#readme",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.cjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "unbuild",
|
|
38
|
+
"dev": "tsx --env-file=.env playground/index.ts",
|
|
39
|
+
"test": "vitest"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"discord.js": "^14.17.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@magicyan/config": "*",
|
|
46
|
+
"tsx": "^4.7.0",
|
|
47
|
+
"unbuild": "^2.0.0",
|
|
48
|
+
"vite-tsconfig-paths": "^5.1.0",
|
|
49
|
+
"vitest": "^2.1.4"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@magicyan/core": "^1.0.20"
|
|
53
|
+
}
|
|
54
|
+
}
|