@magicyan/discord 1.2.1 → 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 CHANGED
@@ -7,7 +7,6 @@
7
7
  </div>
8
8
  </div>
9
9
 
10
-
11
10
  Simple functions to facilitate discord bot development
12
11
  > Also exports all [@magicyan/core](https://github.com/rinckodev/magicyan/tree/main/packages/core) functions
13
12
 
@@ -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.GuildEmojisAndStickers,
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.GuildEmojisAndStickers,
13
+ IntentsBitField.Flags.GuildExpressions,
14
14
  IntentsBitField.Flags.GuildIntegrations,
15
15
  IntentsBitField.Flags.GuildInvites,
16
16
  IntentsBitField.Flags.GuildMembers,
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var EmbedLimit = /* @__PURE__ */ ((EmbedLimit2) => {
4
+ EmbedLimit2[EmbedLimit2["AuthorName"] = 256] = "AuthorName";
5
+ EmbedLimit2[EmbedLimit2["Title"] = 256] = "Title";
6
+ EmbedLimit2[EmbedLimit2["Description"] = 4096] = "Description";
7
+ EmbedLimit2[EmbedLimit2["Fields"] = 25] = "Fields";
8
+ EmbedLimit2[EmbedLimit2["FieldName"] = 256] = "FieldName";
9
+ EmbedLimit2[EmbedLimit2["FieldValue"] = 1024] = "FieldValue";
10
+ EmbedLimit2[EmbedLimit2["FooterText"] = 2048] = "FooterText";
11
+ EmbedLimit2[EmbedLimit2["URL"] = 2048] = "URL";
12
+ return EmbedLimit2;
13
+ })(EmbedLimit || {});
14
+
15
+ exports.EmbedLimit = EmbedLimit;
@@ -0,0 +1,13 @@
1
+ var EmbedLimit = /* @__PURE__ */ ((EmbedLimit2) => {
2
+ EmbedLimit2[EmbedLimit2["AuthorName"] = 256] = "AuthorName";
3
+ EmbedLimit2[EmbedLimit2["Title"] = 256] = "Title";
4
+ EmbedLimit2[EmbedLimit2["Description"] = 4096] = "Description";
5
+ EmbedLimit2[EmbedLimit2["Fields"] = 25] = "Fields";
6
+ EmbedLimit2[EmbedLimit2["FieldName"] = 256] = "FieldName";
7
+ EmbedLimit2[EmbedLimit2["FieldValue"] = 1024] = "FieldValue";
8
+ EmbedLimit2[EmbedLimit2["FooterText"] = 2048] = "FooterText";
9
+ EmbedLimit2[EmbedLimit2["URL"] = 2048] = "URL";
10
+ return EmbedLimit2;
11
+ })(EmbedLimit || {});
12
+
13
+ export { EmbedLimit };
@@ -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.png" }, space = 2) {
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
- setBorderColor(color) {
64
+ setColor(color) {
65
65
  if (color === null) {
66
- this.setColor(colors.colors.embedbg);
66
+ super.setColor(colors.colors.embedbg);
67
67
  } else if (typeof color === "number") {
68
68
  this.update({ color });
69
69
  } else {
70
- this.setColor(color);
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.png" }, space = 2) {
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
- setBorderColor(color) {
62
+ setColor(color) {
63
63
  if (color === null) {
64
- this.setColor(colors.embedbg);
64
+ super.setColor(colors.embedbg);
65
65
  } else if (typeof color === "number") {
66
66
  this.update({ color });
67
67
  } else {
68
- this.setColor(color);
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: core.notFound(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: notFound(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.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const chars = require('./constants/chars.cjs');
4
4
  const client = require('./constants/client.cjs');
5
+ const embed = require('./constants/embed.cjs');
5
6
  const misc = require('./functions/misc.cjs');
6
7
  const assets = require('./functions/embeds/assets.cjs');
7
8
  const author = require('./functions/embeds/author.cjs');
@@ -24,6 +25,7 @@ const core = require('@magicyan/core');
24
25
  exports.chars = chars.chars;
25
26
  exports.CustomItents = client.CustomItents;
26
27
  exports.CustomPartials = client.CustomPartials;
28
+ exports.EmbedLimit = embed.EmbedLimit;
27
29
  exports.setMobileStatus = misc.setMobileStatus;
28
30
  exports.createEmbedAsset = assets.createEmbedAsset;
29
31
  exports.createEmbedAuthor = author.createEmbedAuthor;
package/dist/index.d.cts CHANGED
@@ -16,6 +16,21 @@ declare const CustomPartials: {
16
16
  All: Partials[];
17
17
  };
18
18
 
19
+ /**
20
+ * Embed limits
21
+ * @see https://discordjs.guide/popular-topics/embeds.html#embed-limits
22
+ */
23
+ declare enum EmbedLimit {
24
+ AuthorName = 256,
25
+ Title = 256,
26
+ Description = 4096,
27
+ Fields = 25,
28
+ FieldName = 256,
29
+ FieldValue = 1024,
30
+ FooterText = 2048,
31
+ URL = 2048
32
+ }
33
+
19
34
  declare function setMobileStatus(): void;
20
35
 
21
36
  type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
@@ -139,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
139
154
  toArray(): EmbedPlusBuilder[];
140
155
  toString(space?: number): string;
141
156
  toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
142
- setBorderColor(color: EmbedPlusColorData | null): this;
157
+ setColor(color: ColorResolvable | null): this;
143
158
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
144
159
  setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
145
160
  }
@@ -293,4 +308,4 @@ declare function findRole(guild: Guild): {
293
308
  */
294
309
  declare function extractMentionId(mention: string): string | null;
295
310
 
296
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
311
+ export { type AnyEmbedData, CustomItents, CustomPartials, EmbedLimit, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, 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
@@ -16,6 +16,21 @@ declare const CustomPartials: {
16
16
  All: Partials[];
17
17
  };
18
18
 
19
+ /**
20
+ * Embed limits
21
+ * @see https://discordjs.guide/popular-topics/embeds.html#embed-limits
22
+ */
23
+ declare enum EmbedLimit {
24
+ AuthorName = 256,
25
+ Title = 256,
26
+ Description = 4096,
27
+ Fields = 25,
28
+ FieldName = 256,
29
+ FieldValue = 1024,
30
+ FooterText = 2048,
31
+ URL = 2048
32
+ }
33
+
19
34
  declare function setMobileStatus(): void;
20
35
 
21
36
  type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
@@ -139,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
139
154
  toArray(): EmbedPlusBuilder[];
140
155
  toString(space?: number): string;
141
156
  toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
142
- setBorderColor(color: EmbedPlusColorData | null): this;
157
+ setColor(color: ColorResolvable | null): this;
143
158
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
144
159
  setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
145
160
  }
@@ -293,4 +308,4 @@ declare function findRole(guild: Guild): {
293
308
  */
294
309
  declare function extractMentionId(mention: string): string | null;
295
310
 
296
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
311
+ export { type AnyEmbedData, CustomItents, CustomPartials, EmbedLimit, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, 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
@@ -16,6 +16,21 @@ declare const CustomPartials: {
16
16
  All: Partials[];
17
17
  };
18
18
 
19
+ /**
20
+ * Embed limits
21
+ * @see https://discordjs.guide/popular-topics/embeds.html#embed-limits
22
+ */
23
+ declare enum EmbedLimit {
24
+ AuthorName = 256,
25
+ Title = 256,
26
+ Description = 4096,
27
+ Fields = 25,
28
+ FieldName = 256,
29
+ FieldValue = 1024,
30
+ FooterText = 2048,
31
+ URL = 2048
32
+ }
33
+
19
34
  declare function setMobileStatus(): void;
20
35
 
21
36
  type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
@@ -139,7 +154,7 @@ declare class EmbedPlusBuilder extends EmbedBuilder {
139
154
  toArray(): EmbedPlusBuilder[];
140
155
  toString(space?: number): string;
141
156
  toAttachment(data?: AttachmentData, space?: number): AttachmentBuilder;
142
- setBorderColor(color: EmbedPlusColorData | null): this;
157
+ setColor(color: ColorResolvable | null): this;
143
158
  setAsset(asset: "thumbnail" | "image", source: EmbedPlusAssetData): this;
144
159
  setElementImageURL(element: "thumbnail" | "image" | "author" | "footer", url: string | null): this;
145
160
  }
@@ -293,4 +308,4 @@ declare function findRole(guild: Guild): {
293
308
  */
294
309
  declare function extractMentionId(mention: string): string | null;
295
310
 
296
- export { type AnyEmbedData, CustomItents, CustomPartials, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createLinkButton, createModalFields, createModalInput, createRow, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
311
+ export { type AnyEmbedData, CustomItents, CustomPartials, EmbedLimit, type EmbedPlusAssetData, type EmbedPlusAuthorData, EmbedPlusBuilder, type EmbedPlusColorData, type EmbedPlusData, type EmbedPlusFooterData, type EmbedPlusProperty, chars, commandMention, 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
@@ -1,5 +1,6 @@
1
1
  export { chars } from './constants/chars.mjs';
2
2
  export { CustomItents, CustomPartials } from './constants/client.mjs';
3
+ export { EmbedLimit } from './constants/embed.mjs';
3
4
  export { setMobileStatus } from './functions/misc.mjs';
4
5
  export { createEmbedAsset } from './functions/embeds/assets.mjs';
5
6
  export { createEmbedAuthor } from './functions/embeds/author.mjs';
package/package.json CHANGED
@@ -1,47 +1,54 @@
1
- {
2
- "name": "@magicyan/discord",
3
- "version": "1.2.1",
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/core"
14
- },
15
- "author": "Rincko Dev (https://github.com/rinckodev)",
16
- "bugs": {
17
- "url": "https://github.com/rinckodev/magicyan/issues"
18
- },
19
- "homepage": "https://github.com/rinckodev/magicyan/tree/main/packages/discord#readme",
20
- "exports": {
21
- ".": {
22
- "types": "./dist/index.d.ts",
23
- "import": "./dist/index.mjs",
24
- "require": "./dist/index.cjs"
25
- }
26
- },
27
- "main": "./dist/index.cjs",
28
- "module": "./dist/index.mjs",
29
- "types": "./dist/index.d.ts",
30
- "files": [
31
- "dist"
32
- ],
33
- "scripts": {
34
- "build": "unbuild",
35
- "dev": "tsx --env-file .env playground/index.ts"
36
- },
37
- "devDependencies": {
38
- "tsx": "^4.19.1",
39
- "unbuild": "^2.0.0"
40
- },
41
- "dependencies": {
42
- "@magicyan/core": "^1.0.20"
43
- },
44
- "peerDependencies": {
45
- "discord.js": "^14.16.3"
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
+ }