@magicyan/discord 1.3.0 → 1.3.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/webhooks.cjs +16 -0
- package/dist/functions/webhooks.mjs +14 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +5 -2
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +1 -0
- package/package.json +54 -54
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function createWebhookClient(info, options) {
|
|
6
|
+
try {
|
|
7
|
+
return new discord_js.WebhookClient(
|
|
8
|
+
typeof info === "string" ? { url: info } : info,
|
|
9
|
+
options
|
|
10
|
+
);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.createWebhookClient = createWebhookClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WebhookClient } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function createWebhookClient(info, options) {
|
|
4
|
+
try {
|
|
5
|
+
return new WebhookClient(
|
|
6
|
+
typeof info === "string" ? { url: info } : info,
|
|
7
|
+
options
|
|
8
|
+
);
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { createWebhookClient };
|
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,7 @@ const members = require('./functions/members.cjs');
|
|
|
18
18
|
const message = require('./functions/message.cjs');
|
|
19
19
|
const roles = require('./functions/roles.cjs');
|
|
20
20
|
const regex = require('./functions/regex.cjs');
|
|
21
|
+
const webhooks = require('./functions/webhooks.cjs');
|
|
21
22
|
const core = require('@magicyan/core');
|
|
22
23
|
|
|
23
24
|
|
|
@@ -48,6 +49,7 @@ exports.findMessage = message.findMessage;
|
|
|
48
49
|
exports.getMessageUrlInfo = message.getMessageUrlInfo;
|
|
49
50
|
exports.findRole = roles.findRole;
|
|
50
51
|
exports.extractMentionId = regex.extractMentionId;
|
|
52
|
+
exports.createWebhookClient = webhooks.createWebhookClient;
|
|
51
53
|
Object.keys(core).forEach(function (k) {
|
|
52
54
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = core[k];
|
|
53
55
|
});
|
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, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, 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, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -308,4 +308,7 @@ declare function findRole(guild: Guild): {
|
|
|
308
308
|
*/
|
|
309
309
|
declare function extractMentionId(mention: string): string | null;
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
|
|
312
|
+
declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
|
|
313
|
+
|
|
314
|
+
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, createWebhookClient, 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, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, 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, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -308,4 +308,7 @@ declare function findRole(guild: Guild): {
|
|
|
308
308
|
*/
|
|
309
309
|
declare function extractMentionId(mention: string): string | null;
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
|
|
312
|
+
declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
|
|
313
|
+
|
|
314
|
+
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, createWebhookClient, 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, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, AnyComponentBuilder, ActionRowBuilder, ButtonBuilder, LinkButtonComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, 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, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const chars: {
|
|
@@ -308,4 +308,7 @@ declare function findRole(guild: Guild): {
|
|
|
308
308
|
*/
|
|
309
309
|
declare function extractMentionId(mention: string): string | null;
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
|
|
312
|
+
declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
|
|
313
|
+
|
|
314
|
+
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, createWebhookClient, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, modalFieldsToRecord, setMobileStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -16,4 +16,5 @@ export { findMember } from './functions/members.mjs';
|
|
|
16
16
|
export { findMessage, getMessageUrlInfo } from './functions/message.mjs';
|
|
17
17
|
export { findRole } from './functions/roles.mjs';
|
|
18
18
|
export { extractMentionId } from './functions/regex.mjs';
|
|
19
|
+
export { createWebhookClient } from './functions/webhooks.mjs';
|
|
19
20
|
export * from '@magicyan/core';
|
package/package.json
CHANGED
|
@@ -1,54 +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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@magicyan/discord",
|
|
3
|
+
"version": "1.3.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/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.19.3",
|
|
47
|
+
"unbuild": "^2.0.0",
|
|
48
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
49
|
+
"vitest": "^2.1.9"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@magicyan/core": "^1.0.21"
|
|
53
|
+
}
|
|
54
|
+
}
|