@magicyan/discord 1.0.15 → 1.0.17
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/constants/client.cjs +52 -0
- package/dist/constants/client.mjs +49 -0
- package/dist/functions/channels.cjs +50 -0
- package/dist/functions/channels.mjs +48 -0
- package/dist/functions/commands.cjs +20 -0
- package/dist/functions/commands.mjs +18 -0
- package/dist/functions/components.cjs +54 -0
- package/dist/functions/components.mjs +52 -0
- package/dist/functions/embeds.cjs +52 -0
- package/dist/functions/embeds.mjs +47 -0
- package/dist/functions/emojis.cjs +18 -0
- package/dist/functions/emojis.mjs +16 -0
- package/dist/functions/format.cjs +16 -0
- package/dist/functions/format.mjs +14 -0
- package/dist/functions/members.cjs +26 -0
- package/dist/functions/members.mjs +24 -0
- package/dist/functions/roles.cjs +23 -0
- package/dist/functions/roles.mjs +21 -0
- package/dist/functions/utils.cjs +19 -0
- package/dist/functions/utils.mjs +15 -0
- package/dist/index.cjs +35 -2
- package/dist/index.d.cts +27 -3
- package/dist/index.d.mts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.mjs +11 -2
- package/package.json +47 -47
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
const Messages = [
|
|
6
|
+
discord_js.IntentsBitField.Flags.MessageContent,
|
|
7
|
+
discord_js.IntentsBitField.Flags.GuildMessages,
|
|
8
|
+
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
|
|
13
|
+
];
|
|
14
|
+
const Guild = [
|
|
15
|
+
discord_js.IntentsBitField.Flags.GuildEmojisAndStickers,
|
|
16
|
+
discord_js.IntentsBitField.Flags.GuildIntegrations,
|
|
17
|
+
discord_js.IntentsBitField.Flags.GuildInvites,
|
|
18
|
+
discord_js.IntentsBitField.Flags.GuildMembers,
|
|
19
|
+
discord_js.IntentsBitField.Flags.GuildMessageReactions,
|
|
20
|
+
discord_js.IntentsBitField.Flags.GuildMessageTyping,
|
|
21
|
+
discord_js.IntentsBitField.Flags.GuildMessages,
|
|
22
|
+
discord_js.IntentsBitField.Flags.GuildModeration,
|
|
23
|
+
discord_js.IntentsBitField.Flags.GuildPresences,
|
|
24
|
+
discord_js.IntentsBitField.Flags.GuildScheduledEvents,
|
|
25
|
+
discord_js.IntentsBitField.Flags.GuildVoiceStates,
|
|
26
|
+
discord_js.IntentsBitField.Flags.GuildWebhooks,
|
|
27
|
+
discord_js.IntentsBitField.Flags.Guilds
|
|
28
|
+
];
|
|
29
|
+
const Other = [
|
|
30
|
+
discord_js.IntentsBitField.Flags.AutoModerationConfiguration,
|
|
31
|
+
discord_js.IntentsBitField.Flags.AutoModerationExecution
|
|
32
|
+
];
|
|
33
|
+
const CustomItents = {
|
|
34
|
+
Messages,
|
|
35
|
+
Guild,
|
|
36
|
+
Other,
|
|
37
|
+
All: Object.values(discord_js.IntentsBitField.Flags)
|
|
38
|
+
};
|
|
39
|
+
const CustomPartials = {
|
|
40
|
+
All: [
|
|
41
|
+
discord_js.Partials.Channel,
|
|
42
|
+
discord_js.Partials.GuildMember,
|
|
43
|
+
discord_js.Partials.GuildScheduledEvent,
|
|
44
|
+
discord_js.Partials.Message,
|
|
45
|
+
discord_js.Partials.Reaction,
|
|
46
|
+
discord_js.Partials.ThreadMember,
|
|
47
|
+
discord_js.Partials.User
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.CustomItents = CustomItents;
|
|
52
|
+
exports.CustomPartials = CustomPartials;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IntentsBitField, Partials } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
const Messages = [
|
|
4
|
+
IntentsBitField.Flags.MessageContent,
|
|
5
|
+
IntentsBitField.Flags.GuildMessages,
|
|
6
|
+
IntentsBitField.Flags.GuildMessageReactions,
|
|
7
|
+
IntentsBitField.Flags.GuildMessageTyping,
|
|
8
|
+
IntentsBitField.Flags.DirectMessages,
|
|
9
|
+
IntentsBitField.Flags.DirectMessageReactions,
|
|
10
|
+
IntentsBitField.Flags.DirectMessageTyping
|
|
11
|
+
];
|
|
12
|
+
const Guild = [
|
|
13
|
+
IntentsBitField.Flags.GuildEmojisAndStickers,
|
|
14
|
+
IntentsBitField.Flags.GuildIntegrations,
|
|
15
|
+
IntentsBitField.Flags.GuildInvites,
|
|
16
|
+
IntentsBitField.Flags.GuildMembers,
|
|
17
|
+
IntentsBitField.Flags.GuildMessageReactions,
|
|
18
|
+
IntentsBitField.Flags.GuildMessageTyping,
|
|
19
|
+
IntentsBitField.Flags.GuildMessages,
|
|
20
|
+
IntentsBitField.Flags.GuildModeration,
|
|
21
|
+
IntentsBitField.Flags.GuildPresences,
|
|
22
|
+
IntentsBitField.Flags.GuildScheduledEvents,
|
|
23
|
+
IntentsBitField.Flags.GuildVoiceStates,
|
|
24
|
+
IntentsBitField.Flags.GuildWebhooks,
|
|
25
|
+
IntentsBitField.Flags.Guilds
|
|
26
|
+
];
|
|
27
|
+
const Other = [
|
|
28
|
+
IntentsBitField.Flags.AutoModerationConfiguration,
|
|
29
|
+
IntentsBitField.Flags.AutoModerationExecution
|
|
30
|
+
];
|
|
31
|
+
const CustomItents = {
|
|
32
|
+
Messages,
|
|
33
|
+
Guild,
|
|
34
|
+
Other,
|
|
35
|
+
All: Object.values(IntentsBitField.Flags)
|
|
36
|
+
};
|
|
37
|
+
const CustomPartials = {
|
|
38
|
+
All: [
|
|
39
|
+
Partials.Channel,
|
|
40
|
+
Partials.GuildMember,
|
|
41
|
+
Partials.GuildScheduledEvent,
|
|
42
|
+
Partials.Message,
|
|
43
|
+
Partials.Reaction,
|
|
44
|
+
Partials.ThreadMember,
|
|
45
|
+
Partials.User
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { CustomItents, CustomPartials };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function findChannel(guild, type) {
|
|
6
|
+
const channelType = type ?? discord_js.ChannelType.GuildText;
|
|
7
|
+
const cache = guild.channels.cache;
|
|
8
|
+
return {
|
|
9
|
+
byName(name) {
|
|
10
|
+
return cache.find(
|
|
11
|
+
(c) => c.name === name && c.type === channelType
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
byId(id) {
|
|
15
|
+
return cache.find(
|
|
16
|
+
(c) => c.id === id && c.type === channelType
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
inCategoryId(id) {
|
|
20
|
+
return {
|
|
21
|
+
byName(name) {
|
|
22
|
+
return cache.find(
|
|
23
|
+
(c) => c.name === name && c.type === channelType && c.parentId == id
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
byId(id2) {
|
|
27
|
+
return cache.find(
|
|
28
|
+
(c) => c.id === id2 && c.type === channelType && c.parentId == id2
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
inCategoryName(name) {
|
|
34
|
+
return {
|
|
35
|
+
byName(name2) {
|
|
36
|
+
return cache.find(
|
|
37
|
+
(c) => c.name === name2 && c.type === channelType && c.parent?.name == name2
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
byId(id) {
|
|
41
|
+
return cache.find(
|
|
42
|
+
(c) => c.id === id && c.type === channelType && c.parent?.name == name
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.findChannel = findChannel;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ChannelType } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function findChannel(guild, type) {
|
|
4
|
+
const channelType = type ?? ChannelType.GuildText;
|
|
5
|
+
const cache = guild.channels.cache;
|
|
6
|
+
return {
|
|
7
|
+
byName(name) {
|
|
8
|
+
return cache.find(
|
|
9
|
+
(c) => c.name === name && c.type === channelType
|
|
10
|
+
);
|
|
11
|
+
},
|
|
12
|
+
byId(id) {
|
|
13
|
+
return cache.find(
|
|
14
|
+
(c) => c.id === id && c.type === channelType
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
inCategoryId(id) {
|
|
18
|
+
return {
|
|
19
|
+
byName(name) {
|
|
20
|
+
return cache.find(
|
|
21
|
+
(c) => c.name === name && c.type === channelType && c.parentId == id
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
byId(id2) {
|
|
25
|
+
return cache.find(
|
|
26
|
+
(c) => c.id === id2 && c.type === channelType && c.parentId == id2
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
inCategoryName(name) {
|
|
32
|
+
return {
|
|
33
|
+
byName(name2) {
|
|
34
|
+
return cache.find(
|
|
35
|
+
(c) => c.name === name2 && c.type === channelType && c.parent?.name == name2
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
byId(id) {
|
|
39
|
+
return cache.find(
|
|
40
|
+
(c) => c.id === id && c.type === channelType && c.parent?.name == name
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { findChannel };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function findCommand(guildOrClient) {
|
|
6
|
+
const commands = guildOrClient instanceof discord_js.Client ? guildOrClient.application.commands.cache : guildOrClient.commands.cache;
|
|
7
|
+
return {
|
|
8
|
+
byName(name, and = () => true) {
|
|
9
|
+
return commands.find((command) => command.name === name && and(command));
|
|
10
|
+
},
|
|
11
|
+
byId(id) {
|
|
12
|
+
return commands.get(id);
|
|
13
|
+
},
|
|
14
|
+
byFilter(filter) {
|
|
15
|
+
return commands.find(filter);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.findCommand = findCommand;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function findCommand(guildOrClient) {
|
|
4
|
+
const commands = guildOrClient instanceof Client ? guildOrClient.application.commands.cache : guildOrClient.commands.cache;
|
|
5
|
+
return {
|
|
6
|
+
byName(name, and = () => true) {
|
|
7
|
+
return commands.find((command) => command.name === name && and(command));
|
|
8
|
+
},
|
|
9
|
+
byId(id) {
|
|
10
|
+
return commands.get(id);
|
|
11
|
+
},
|
|
12
|
+
byFilter(filter) {
|
|
13
|
+
return commands.find(filter);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { findCommand };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function createComponentsManager(components) {
|
|
6
|
+
const buttons = components.flatMap(
|
|
7
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.Button)
|
|
8
|
+
);
|
|
9
|
+
const stringSelects = components.flatMap(
|
|
10
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.StringSelect)
|
|
11
|
+
);
|
|
12
|
+
const userSelects = components.flatMap(
|
|
13
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.UserSelect)
|
|
14
|
+
);
|
|
15
|
+
const channelSelects = components.flatMap(
|
|
16
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.ChannelSelect)
|
|
17
|
+
);
|
|
18
|
+
const roleSelects = components.flatMap(
|
|
19
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.RoleSelect)
|
|
20
|
+
);
|
|
21
|
+
const mentionableSelects = components.flatMap(
|
|
22
|
+
(row) => row.components.filter((c) => c.type === discord_js.ComponentType.Button)
|
|
23
|
+
);
|
|
24
|
+
return {
|
|
25
|
+
getButton(customId) {
|
|
26
|
+
return buttons.find((b) => b.customId === customId);
|
|
27
|
+
},
|
|
28
|
+
getStringSelect(customId) {
|
|
29
|
+
return stringSelects.find((b) => b.customId === customId);
|
|
30
|
+
},
|
|
31
|
+
getUserSelect(customId) {
|
|
32
|
+
return userSelects.find((b) => b.customId === customId);
|
|
33
|
+
},
|
|
34
|
+
getChannelSelect(customId) {
|
|
35
|
+
return channelSelects.find((b) => b.customId === customId);
|
|
36
|
+
},
|
|
37
|
+
getRoleSelect(customId) {
|
|
38
|
+
return roleSelects.find((b) => b.customId === customId);
|
|
39
|
+
},
|
|
40
|
+
getMentionableSelect(customId) {
|
|
41
|
+
return mentionableSelects.find((b) => b.customId === customId);
|
|
42
|
+
},
|
|
43
|
+
resolved: {
|
|
44
|
+
buttons,
|
|
45
|
+
stringSelects,
|
|
46
|
+
userSelects,
|
|
47
|
+
channelSelects,
|
|
48
|
+
roleSelects,
|
|
49
|
+
mentionableSelects
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
exports.createComponentsManager = createComponentsManager;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ComponentType } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function createComponentsManager(components) {
|
|
4
|
+
const buttons = components.flatMap(
|
|
5
|
+
(row) => row.components.filter((c) => c.type === ComponentType.Button)
|
|
6
|
+
);
|
|
7
|
+
const stringSelects = components.flatMap(
|
|
8
|
+
(row) => row.components.filter((c) => c.type === ComponentType.StringSelect)
|
|
9
|
+
);
|
|
10
|
+
const userSelects = components.flatMap(
|
|
11
|
+
(row) => row.components.filter((c) => c.type === ComponentType.UserSelect)
|
|
12
|
+
);
|
|
13
|
+
const channelSelects = components.flatMap(
|
|
14
|
+
(row) => row.components.filter((c) => c.type === ComponentType.ChannelSelect)
|
|
15
|
+
);
|
|
16
|
+
const roleSelects = components.flatMap(
|
|
17
|
+
(row) => row.components.filter((c) => c.type === ComponentType.RoleSelect)
|
|
18
|
+
);
|
|
19
|
+
const mentionableSelects = components.flatMap(
|
|
20
|
+
(row) => row.components.filter((c) => c.type === ComponentType.Button)
|
|
21
|
+
);
|
|
22
|
+
return {
|
|
23
|
+
getButton(customId) {
|
|
24
|
+
return buttons.find((b) => b.customId === customId);
|
|
25
|
+
},
|
|
26
|
+
getStringSelect(customId) {
|
|
27
|
+
return stringSelects.find((b) => b.customId === customId);
|
|
28
|
+
},
|
|
29
|
+
getUserSelect(customId) {
|
|
30
|
+
return userSelects.find((b) => b.customId === customId);
|
|
31
|
+
},
|
|
32
|
+
getChannelSelect(customId) {
|
|
33
|
+
return channelSelects.find((b) => b.customId === customId);
|
|
34
|
+
},
|
|
35
|
+
getRoleSelect(customId) {
|
|
36
|
+
return roleSelects.find((b) => b.customId === customId);
|
|
37
|
+
},
|
|
38
|
+
getMentionableSelect(customId) {
|
|
39
|
+
return mentionableSelects.find((b) => b.customId === customId);
|
|
40
|
+
},
|
|
41
|
+
resolved: {
|
|
42
|
+
buttons,
|
|
43
|
+
stringSelects,
|
|
44
|
+
userSelects,
|
|
45
|
+
channelSelects,
|
|
46
|
+
roleSelects,
|
|
47
|
+
mentionableSelects
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { createComponentsManager };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const core = require('@magicyan/core');
|
|
4
|
+
const discord_js = require('discord.js');
|
|
5
|
+
|
|
6
|
+
function createEmbedAuthor(options) {
|
|
7
|
+
const {
|
|
8
|
+
user,
|
|
9
|
+
property = "displayName",
|
|
10
|
+
imageSize: size = 512,
|
|
11
|
+
iconURL,
|
|
12
|
+
url,
|
|
13
|
+
prefix = "",
|
|
14
|
+
suffix = ""
|
|
15
|
+
} = options;
|
|
16
|
+
return {
|
|
17
|
+
name: `${prefix}${user[property]}${suffix}`,
|
|
18
|
+
url,
|
|
19
|
+
iconURL: iconURL || user.displayAvatarURL({ size })
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function createEmbedFooter(options) {
|
|
23
|
+
const { text, iconURL } = options;
|
|
24
|
+
return { text: text ?? "\u200B", iconURL: core.notFound(iconURL) };
|
|
25
|
+
}
|
|
26
|
+
function createEmbedAsset(source, options) {
|
|
27
|
+
if (source instanceof discord_js.Attachment || source instanceof discord_js.AttachmentBuilder) {
|
|
28
|
+
return { url: `attachment://${source.name}`, ...options };
|
|
29
|
+
}
|
|
30
|
+
return source ? { url: source, ...options } : void 0;
|
|
31
|
+
}
|
|
32
|
+
function createEmbed(options) {
|
|
33
|
+
const { extend: extendRaw = {}, ...embedRaw } = options;
|
|
34
|
+
const { color: embedColor, modify, ...embedData } = embedRaw;
|
|
35
|
+
const { color: extendColor, ...extendData } = extendRaw;
|
|
36
|
+
const data = { ...extendData, ...embedData };
|
|
37
|
+
const builder = new discord_js.EmbedBuilder(data);
|
|
38
|
+
if (extendColor)
|
|
39
|
+
builder.setColor(extendColor);
|
|
40
|
+
if (embedColor)
|
|
41
|
+
builder.setColor(embedColor);
|
|
42
|
+
if (modify?.fields && typeof modify.fields == "function") {
|
|
43
|
+
const fields = modify.fields(builder.data.fields || []);
|
|
44
|
+
builder.setFields(fields);
|
|
45
|
+
}
|
|
46
|
+
return builder;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
exports.createEmbed = createEmbed;
|
|
50
|
+
exports.createEmbedAsset = createEmbedAsset;
|
|
51
|
+
exports.createEmbedAuthor = createEmbedAuthor;
|
|
52
|
+
exports.createEmbedFooter = createEmbedFooter;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { notFound } from '@magicyan/core';
|
|
2
|
+
import { Attachment, AttachmentBuilder, EmbedBuilder } from 'discord.js';
|
|
3
|
+
|
|
4
|
+
function createEmbedAuthor(options) {
|
|
5
|
+
const {
|
|
6
|
+
user,
|
|
7
|
+
property = "displayName",
|
|
8
|
+
imageSize: size = 512,
|
|
9
|
+
iconURL,
|
|
10
|
+
url,
|
|
11
|
+
prefix = "",
|
|
12
|
+
suffix = ""
|
|
13
|
+
} = options;
|
|
14
|
+
return {
|
|
15
|
+
name: `${prefix}${user[property]}${suffix}`,
|
|
16
|
+
url,
|
|
17
|
+
iconURL: iconURL || user.displayAvatarURL({ size })
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function createEmbedFooter(options) {
|
|
21
|
+
const { text, iconURL } = options;
|
|
22
|
+
return { text: text ?? "\u200B", iconURL: notFound(iconURL) };
|
|
23
|
+
}
|
|
24
|
+
function createEmbedAsset(source, options) {
|
|
25
|
+
if (source instanceof Attachment || source instanceof AttachmentBuilder) {
|
|
26
|
+
return { url: `attachment://${source.name}`, ...options };
|
|
27
|
+
}
|
|
28
|
+
return source ? { url: source, ...options } : void 0;
|
|
29
|
+
}
|
|
30
|
+
function createEmbed(options) {
|
|
31
|
+
const { extend: extendRaw = {}, ...embedRaw } = options;
|
|
32
|
+
const { color: embedColor, modify, ...embedData } = embedRaw;
|
|
33
|
+
const { color: extendColor, ...extendData } = extendRaw;
|
|
34
|
+
const data = { ...extendData, ...embedData };
|
|
35
|
+
const builder = new EmbedBuilder(data);
|
|
36
|
+
if (extendColor)
|
|
37
|
+
builder.setColor(extendColor);
|
|
38
|
+
if (embedColor)
|
|
39
|
+
builder.setColor(embedColor);
|
|
40
|
+
if (modify?.fields && typeof modify.fields == "function") {
|
|
41
|
+
const fields = modify.fields(builder.data.fields || []);
|
|
42
|
+
builder.setFields(fields);
|
|
43
|
+
}
|
|
44
|
+
return builder;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function findEmoji(guildOrClient) {
|
|
4
|
+
const emojis = guildOrClient.emojis.cache;
|
|
5
|
+
return {
|
|
6
|
+
byName(name, animated, and = () => true) {
|
|
7
|
+
return animated ? emojis.find((emoji) => emoji.name == name && emoji.animated == animated && and(emoji)) : emojis.find((emoji) => emoji.name == name && and(emoji));
|
|
8
|
+
},
|
|
9
|
+
byId(id, animated) {
|
|
10
|
+
return animated ? emojis.find((emoji) => emoji.id == id && emoji.animated == animated) : emojis.find((emoji) => emoji.id == id);
|
|
11
|
+
},
|
|
12
|
+
byFilter(filter) {
|
|
13
|
+
return guildOrClient.emojis.cache.find(filter);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.findEmoji = findEmoji;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function findEmoji(guildOrClient) {
|
|
2
|
+
const emojis = guildOrClient.emojis.cache;
|
|
3
|
+
return {
|
|
4
|
+
byName(name, animated, and = () => true) {
|
|
5
|
+
return animated ? emojis.find((emoji) => emoji.name == name && emoji.animated == animated && and(emoji)) : emojis.find((emoji) => emoji.name == name && and(emoji));
|
|
6
|
+
},
|
|
7
|
+
byId(id, animated) {
|
|
8
|
+
return animated ? emojis.find((emoji) => emoji.id == id && emoji.animated == animated) : emojis.find((emoji) => emoji.id == id);
|
|
9
|
+
},
|
|
10
|
+
byFilter(filter) {
|
|
11
|
+
return guildOrClient.emojis.cache.find(filter);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { findEmoji };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
const formated = {
|
|
6
|
+
mention(type, ref, alt = "") {
|
|
7
|
+
const id = ref?.toString();
|
|
8
|
+
return {
|
|
9
|
+
channel: id ? discord_js.channelMention(id) : alt,
|
|
10
|
+
user: id ? discord_js.userMention(id) : alt,
|
|
11
|
+
role: id ? discord_js.roleMention(id) : alt
|
|
12
|
+
}[type];
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.formated = formated;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { channelMention, userMention, roleMention } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
const formated = {
|
|
4
|
+
mention(type, ref, alt = "") {
|
|
5
|
+
const id = ref?.toString();
|
|
6
|
+
return {
|
|
7
|
+
channel: id ? channelMention(id) : alt,
|
|
8
|
+
user: id ? userMention(id) : alt,
|
|
9
|
+
role: id ? roleMention(id) : alt
|
|
10
|
+
}[type];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { formated };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function findMember(guild) {
|
|
4
|
+
return {
|
|
5
|
+
byGlobalName(globalName, and = () => true) {
|
|
6
|
+
return guild.members.cache.find((member) => member.user.globalName == globalName && and(member));
|
|
7
|
+
},
|
|
8
|
+
byNickname(nickname, and = () => true) {
|
|
9
|
+
return guild.members.cache.find((member) => member.nickname && member.nickname == nickname && and(member));
|
|
10
|
+
},
|
|
11
|
+
byUsername(username, and = () => true) {
|
|
12
|
+
return guild.members.cache.find((member) => member.user.username === username && and(member));
|
|
13
|
+
},
|
|
14
|
+
byDisplayName(displayName, and = () => true) {
|
|
15
|
+
return guild.members.cache.find((member) => member.displayName === displayName && and(member));
|
|
16
|
+
},
|
|
17
|
+
byId(id) {
|
|
18
|
+
return guild.members.cache.get(id);
|
|
19
|
+
},
|
|
20
|
+
byFilter(filter) {
|
|
21
|
+
return guild.members.cache.find(filter);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.findMember = findMember;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function findMember(guild) {
|
|
2
|
+
return {
|
|
3
|
+
byGlobalName(globalName, and = () => true) {
|
|
4
|
+
return guild.members.cache.find((member) => member.user.globalName == globalName && and(member));
|
|
5
|
+
},
|
|
6
|
+
byNickname(nickname, and = () => true) {
|
|
7
|
+
return guild.members.cache.find((member) => member.nickname && member.nickname == nickname && and(member));
|
|
8
|
+
},
|
|
9
|
+
byUsername(username, and = () => true) {
|
|
10
|
+
return guild.members.cache.find((member) => member.user.username === username && and(member));
|
|
11
|
+
},
|
|
12
|
+
byDisplayName(displayName, and = () => true) {
|
|
13
|
+
return guild.members.cache.find((member) => member.displayName === displayName && and(member));
|
|
14
|
+
},
|
|
15
|
+
byId(id) {
|
|
16
|
+
return guild.members.cache.get(id);
|
|
17
|
+
},
|
|
18
|
+
byFilter(filter) {
|
|
19
|
+
return guild.members.cache.find(filter);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { findMember };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function findRole(guild) {
|
|
4
|
+
return {
|
|
5
|
+
byColor(color, and = () => true) {
|
|
6
|
+
return guild.roles.cache.find((role) => role.color == color && and(role));
|
|
7
|
+
},
|
|
8
|
+
byHexColor(hexColor, and = () => true) {
|
|
9
|
+
return guild.roles.cache.find((role) => role.hexColor == hexColor && and(role));
|
|
10
|
+
},
|
|
11
|
+
byName(name, and = () => true) {
|
|
12
|
+
return guild.roles.cache.find((role) => role.name == name && and(role));
|
|
13
|
+
},
|
|
14
|
+
byId(id) {
|
|
15
|
+
return guild.roles.cache.get(id);
|
|
16
|
+
},
|
|
17
|
+
byFilter(filter) {
|
|
18
|
+
return guild.roles.cache.find(filter);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.findRole = findRole;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function findRole(guild) {
|
|
2
|
+
return {
|
|
3
|
+
byColor(color, and = () => true) {
|
|
4
|
+
return guild.roles.cache.find((role) => role.color == color && and(role));
|
|
5
|
+
},
|
|
6
|
+
byHexColor(hexColor, and = () => true) {
|
|
7
|
+
return guild.roles.cache.find((role) => role.hexColor == hexColor && and(role));
|
|
8
|
+
},
|
|
9
|
+
byName(name, and = () => true) {
|
|
10
|
+
return guild.roles.cache.find((role) => role.name == name && and(role));
|
|
11
|
+
},
|
|
12
|
+
byId(id) {
|
|
13
|
+
return guild.roles.cache.get(id);
|
|
14
|
+
},
|
|
15
|
+
byFilter(filter) {
|
|
16
|
+
return guild.roles.cache.find(filter);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { findRole };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const discord_js = require('discord.js');
|
|
4
|
+
|
|
5
|
+
function createRow(...components) {
|
|
6
|
+
return new discord_js.ActionRowBuilder({ components });
|
|
7
|
+
}
|
|
8
|
+
function createModalInput(data) {
|
|
9
|
+
return createRow(new discord_js.TextInputBuilder(data));
|
|
10
|
+
}
|
|
11
|
+
function createLinkButton(data) {
|
|
12
|
+
if (!data.label)
|
|
13
|
+
data.label = data.url;
|
|
14
|
+
return new discord_js.ButtonBuilder({ style: discord_js.ButtonStyle.Link, ...data });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.createLinkButton = createLinkButton;
|
|
18
|
+
exports.createModalInput = createModalInput;
|
|
19
|
+
exports.createRow = createRow;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionRowBuilder, TextInputBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
|
|
2
|
+
|
|
3
|
+
function createRow(...components) {
|
|
4
|
+
return new ActionRowBuilder({ components });
|
|
5
|
+
}
|
|
6
|
+
function createModalInput(data) {
|
|
7
|
+
return createRow(new TextInputBuilder(data));
|
|
8
|
+
}
|
|
9
|
+
function createLinkButton(data) {
|
|
10
|
+
if (!data.label)
|
|
11
|
+
data.label = data.url;
|
|
12
|
+
return new ButtonBuilder({ style: ButtonStyle.Link, ...data });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { createLinkButton, createModalInput, createRow };
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const client = require('./constants/client.cjs');
|
|
4
|
+
const channels = require('./functions/channels.cjs');
|
|
5
|
+
const commands = require('./functions/commands.cjs');
|
|
6
|
+
const components = require('./functions/components.cjs');
|
|
7
|
+
const embeds = require('./functions/embeds.cjs');
|
|
8
|
+
const emojis = require('./functions/emojis.cjs');
|
|
9
|
+
const format = require('./functions/format.cjs');
|
|
10
|
+
const members = require('./functions/members.cjs');
|
|
11
|
+
const roles = require('./functions/roles.cjs');
|
|
12
|
+
const utils = require('./functions/utils.cjs');
|
|
13
|
+
const core = require('@magicyan/core');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.CustomItents = client.CustomItents;
|
|
18
|
+
exports.CustomPartials = client.CustomPartials;
|
|
19
|
+
exports.findChannel = channels.findChannel;
|
|
20
|
+
exports.findCommand = commands.findCommand;
|
|
21
|
+
exports.createComponentsManager = components.createComponentsManager;
|
|
22
|
+
exports.createEmbed = embeds.createEmbed;
|
|
23
|
+
exports.createEmbedAsset = embeds.createEmbedAsset;
|
|
24
|
+
exports.createEmbedAuthor = embeds.createEmbedAuthor;
|
|
25
|
+
exports.createEmbedFooter = embeds.createEmbedFooter;
|
|
26
|
+
exports.findEmoji = emojis.findEmoji;
|
|
27
|
+
exports.formated = format.formated;
|
|
28
|
+
exports.findMember = members.findMember;
|
|
29
|
+
exports.findRole = roles.findRole;
|
|
30
|
+
exports.createLinkButton = utils.createLinkButton;
|
|
31
|
+
exports.createModalInput = utils.createModalInput;
|
|
32
|
+
exports.createRow = utils.createRow;
|
|
33
|
+
Object.keys(core).forEach(function (k) {
|
|
34
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = core[k];
|
|
35
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, ActionRow, MessageActionRowComponent, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,30 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
interface MessageComponentsManager {
|
|
45
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
46
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
47
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
48
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
49
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
50
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
51
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
52
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
53
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
54
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
55
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
56
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
57
|
+
resolved: {
|
|
58
|
+
buttons: ButtonComponent[];
|
|
59
|
+
stringSelects: StringSelectMenuComponent[];
|
|
60
|
+
userSelects: UserSelectMenuComponent[];
|
|
61
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
62
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
63
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
67
|
+
|
|
44
68
|
interface CreateEmbedAuthorOptions {
|
|
45
69
|
user: User;
|
|
46
70
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -118,7 +142,7 @@ declare function findRole(guild: Guild): {
|
|
|
118
142
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
143
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
144
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
145
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
146
|
};
|
|
123
147
|
|
|
124
148
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
@@ -127,4 +151,4 @@ declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<
|
|
|
127
151
|
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
152
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
153
|
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
154
|
+
export { CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, ActionRow, MessageActionRowComponent, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,30 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
interface MessageComponentsManager {
|
|
45
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
46
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
47
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
48
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
49
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
50
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
51
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
52
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
53
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
54
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
55
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
56
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
57
|
+
resolved: {
|
|
58
|
+
buttons: ButtonComponent[];
|
|
59
|
+
stringSelects: StringSelectMenuComponent[];
|
|
60
|
+
userSelects: UserSelectMenuComponent[];
|
|
61
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
62
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
63
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
67
|
+
|
|
44
68
|
interface CreateEmbedAuthorOptions {
|
|
45
69
|
user: User;
|
|
46
70
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -118,7 +142,7 @@ declare function findRole(guild: Guild): {
|
|
|
118
142
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
143
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
144
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
145
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
146
|
};
|
|
123
147
|
|
|
124
148
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
@@ -127,4 +151,4 @@ declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<
|
|
|
127
151
|
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
152
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
153
|
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
154
|
+
export { CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_js from 'discord.js';
|
|
2
|
-
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
2
|
+
import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, ActionRow, MessageActionRowComponent, ButtonComponent, StringSelectMenuComponent, UserSelectMenuComponent, ChannelSelectMenuComponent, RoleSelectMenuComponent, MentionableSelectMenuComponent, EmbedAuthorData, EmbedFooterData, EmbedAssetData, EmbedBuilder, User, ImageURLOptions, Attachment, AttachmentBuilder, ColorResolvable, GuildEmoji, GuildBasedChannel, Role, GuildMember, AnyComponentBuilder, ActionRowBuilder, TextInputBuilder, ButtonBuilder, TextInputComponentData, LinkButtonComponentData } from 'discord.js';
|
|
3
3
|
export * from '@magicyan/core';
|
|
4
4
|
|
|
5
5
|
declare const CustomItents: {
|
|
@@ -41,6 +41,30 @@ declare function findCommand(guildOrClient: Guild | Client<true>): {
|
|
|
41
41
|
}> | undefined;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
interface MessageComponentsManager {
|
|
45
|
+
getButton(customId: string): ButtonComponent | undefined;
|
|
46
|
+
getButton(customId: string, required: true): ButtonComponent;
|
|
47
|
+
getStringSelect(customId: string): StringSelectMenuComponent | undefined;
|
|
48
|
+
getStringSelect(customId: string, required: true): StringSelectMenuComponent;
|
|
49
|
+
getUserSelect(customId: string): UserSelectMenuComponent | undefined;
|
|
50
|
+
getUserSelect(customId: string, required: true): UserSelectMenuComponent;
|
|
51
|
+
getChannelSelect(customId: string): ChannelSelectMenuComponent | undefined;
|
|
52
|
+
getChannelSelect(customId: string, required: true): ChannelSelectMenuComponent;
|
|
53
|
+
getRoleSelect(customId: string): RoleSelectMenuComponent | undefined;
|
|
54
|
+
getRoleSelect(customId: string, required: true): RoleSelectMenuComponent;
|
|
55
|
+
getMentionableSelect(customId: string): MentionableSelectMenuComponent | undefined;
|
|
56
|
+
getMentionableSelect(customId: string, required: true): MentionableSelectMenuComponent;
|
|
57
|
+
resolved: {
|
|
58
|
+
buttons: ButtonComponent[];
|
|
59
|
+
stringSelects: StringSelectMenuComponent[];
|
|
60
|
+
userSelects: UserSelectMenuComponent[];
|
|
61
|
+
channelSelects: ChannelSelectMenuComponent[];
|
|
62
|
+
roleSelects: RoleSelectMenuComponent[];
|
|
63
|
+
mentionableSelects: MentionableSelectMenuComponent[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
declare function createComponentsManager(components: ActionRow<MessageActionRowComponent>[]): MessageComponentsManager;
|
|
67
|
+
|
|
44
68
|
interface CreateEmbedAuthorOptions {
|
|
45
69
|
user: User;
|
|
46
70
|
property?: "username" | "displayName" | "id" | "globalName";
|
|
@@ -118,7 +142,7 @@ declare function findRole(guild: Guild): {
|
|
|
118
142
|
byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
|
|
119
143
|
byName(name: string, and?: FindRoleFilter): Role | undefined;
|
|
120
144
|
byId(id: string): Role | undefined;
|
|
121
|
-
byFilter(filter:
|
|
145
|
+
byFilter(filter: FindRoleFilter): Role | undefined;
|
|
122
146
|
};
|
|
123
147
|
|
|
124
148
|
declare function createRow<Component extends AnyComponentBuilder>(...components: Component[]): ActionRowBuilder<Component>;
|
|
@@ -127,4 +151,4 @@ declare function createModalInput(data: CreateModalInputData): ActionRowBuilder<
|
|
|
127
151
|
type CreateLinkButtonData = Omit<LinkButtonComponentData, "style" | "type">;
|
|
128
152
|
declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
|
|
129
153
|
|
|
130
|
-
export { CustomItents, CustomPartials, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
|
154
|
+
export { CustomItents, CustomPartials, createComponentsManager, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter, createLinkButton, createModalInput, createRow, findChannel, findCommand, findEmoji, findMember, findRole, formated };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { CustomItents, CustomPartials } from './constants/client.mjs';
|
|
2
|
+
export { findChannel } from './functions/channels.mjs';
|
|
3
|
+
export { findCommand } from './functions/commands.mjs';
|
|
4
|
+
export { createComponentsManager } from './functions/components.mjs';
|
|
5
|
+
export { createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFooter } from './functions/embeds.mjs';
|
|
6
|
+
export { findEmoji } from './functions/emojis.mjs';
|
|
7
|
+
export { formated } from './functions/format.mjs';
|
|
8
|
+
export { findMember } from './functions/members.mjs';
|
|
9
|
+
export { findRole } from './functions/roles.mjs';
|
|
10
|
+
export { createLinkButton, createModalInput, createRow } from './functions/utils.mjs';
|
|
11
|
+
export * from '@magicyan/core';
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@magicyan/discord",
|
|
3
|
+
"version": "1.0.17",
|
|
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 playground/index.ts"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"tsx": "^4.7.0",
|
|
39
|
+
"unbuild": "^2.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@magicyan/core": "^1.0.15"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"discord.js": "^14.14.1"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/constants/client.ts","../src/functions/channels.ts","../src/functions/commands.ts","../src/functions/embeds.ts","../src/functions/emojis.ts","../src/functions/format.ts","../src/functions/members.ts","../src/functions/roles.ts","../src/functions/utils.ts"],"sourcesContent":["import { GatewayIntentBits, IntentsBitField, Partials } from \"discord.js\";\r\n\r\nconst Messages = [\r\n IntentsBitField.Flags.MessageContent,\r\n IntentsBitField.Flags.GuildMessages,\r\n IntentsBitField.Flags.GuildMessageReactions,\r\n IntentsBitField.Flags.GuildMessageTyping,\r\n IntentsBitField.Flags.DirectMessages,\r\n IntentsBitField.Flags.DirectMessageReactions,\r\n IntentsBitField.Flags.DirectMessageTyping,\r\n];\r\nconst Guild = [\r\n IntentsBitField.Flags.GuildEmojisAndStickers,\r\n IntentsBitField.Flags.GuildIntegrations,\r\n IntentsBitField.Flags.GuildInvites,\r\n IntentsBitField.Flags.GuildMembers,\r\n IntentsBitField.Flags.GuildMessageReactions,\r\n IntentsBitField.Flags.GuildMessageTyping,\r\n IntentsBitField.Flags.GuildMessages,\r\n IntentsBitField.Flags.GuildModeration,\r\n IntentsBitField.Flags.GuildPresences,\r\n IntentsBitField.Flags.GuildScheduledEvents,\r\n IntentsBitField.Flags.GuildVoiceStates,\r\n IntentsBitField.Flags.GuildWebhooks,\r\n IntentsBitField.Flags.Guilds,\r\n];\r\n\r\nconst Other = [\r\n IntentsBitField.Flags.AutoModerationConfiguration,\r\n IntentsBitField.Flags.AutoModerationExecution,\r\n];\r\n\r\n\r\nexport const CustomItents = {\r\n Messages,\r\n Guild,\r\n Other,\r\n All: Object.values(IntentsBitField.Flags) as GatewayIntentBits[]\r\n};\r\n\r\nexport const CustomPartials = {\r\n All: [\r\n Partials.Channel,\r\n Partials.GuildMember,\r\n Partials.GuildScheduledEvent,\r\n Partials.Message,\r\n Partials.Reaction,\r\n Partials.ThreadMember,\r\n Partials.User,\r\n ]\r\n};","import type { CommandInteractionOption, Guild } from \"discord.js\";\r\nimport { ChannelType } from \"discord.js\";\r\n\r\ntype GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<\"cached\">[\"channel\"]>, {\r\n type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread\r\n ? ChannelType.PublicThread | ChannelType.AnnouncementThread\r\n : Type;\r\n}>\r\nexport function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type){\r\n const channelType = type ?? ChannelType.GuildText;\r\n const cache = guild.channels.cache;\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType\r\n ) as GetChannelType<Type>;\r\n },\r\n inCategoryId(id: string){\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType && \r\n c.parentId == id\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType && \r\n c.parentId == id\r\n ) as GetChannelType<Type>;\r\n },\r\n };\r\n },\r\n inCategoryName(name: string){\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType && \r\n c.parent?.name == name\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType && \r\n c.parent?.name == name\r\n ) as GetChannelType<Type>;\r\n },\r\n };\r\n }\r\n }\r\n}","import { ApplicationCommand, Client, Guild } from \"discord.js\";\r\n\r\ntype FindCommandFilter = (command: ApplicationCommand) => boolean\r\n\r\nexport function findCommand(guildOrClient: Guild | Client<true>){\r\n const commands = guildOrClient instanceof Client\r\n ? guildOrClient.application.commands.cache\r\n : guildOrClient.commands.cache;\r\n\r\n return {\r\n byName(name: string, and: FindCommandFilter = () => true){\r\n return commands.find(command => command.name === name && and(command))\r\n },\r\n byId(id: string){\r\n return commands.get(id)\r\n },\r\n byFilter(filter: FindCommandFilter){\r\n return commands.find(filter);\r\n }\r\n }\r\n}","import { notFound } from \"@magicyan/core\";\r\nimport { Attachment, AttachmentBuilder, ColorResolvable, EmbedAssetData, EmbedAuthorData, EmbedBuilder, EmbedFooterData, Guild, GuildMember, ImageURLOptions, User } from \"discord.js\";\r\n\r\ninterface CreateEmbedAuthorOptions {\r\n user: User,\r\n property?: \"username\" | \"displayName\" | \"id\" | \"globalName\"\r\n imageSize?: ImageURLOptions[\"size\"],\r\n iconURL?: string, url?: string, prefix?: string, suffix?: string,\r\n}\r\nexport function createEmbedAuthor(options: CreateEmbedAuthorOptions): EmbedAuthorData {\r\n const { user, property=\"displayName\", imageSize: size=512, \r\n iconURL, url, prefix=\"\", suffix=\"\"\r\n } = options;\r\n return {\r\n name: `${prefix}${user[property]}${suffix}`, url, \r\n iconURL: iconURL || user.displayAvatarURL({ size }) \r\n };\r\n}\r\n\r\ninterface CreateEmbedFooterOptions {\r\n text?: string | null;\r\n iconURL?: string | null;\r\n}\r\nexport function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData {\r\n const { text, iconURL } = options;\r\n return { text: text ?? \"\\u200b\", iconURL: notFound(iconURL) };\r\n}\r\n\r\ntype EmbedAssetOptions = Omit<EmbedAssetData, \"url\">\r\ntype AssetSource = string | null | Attachment | AttachmentBuilder;\r\n\r\nexport function createEmbedAsset(source?: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined {\r\n if (source instanceof Attachment || source instanceof AttachmentBuilder){\r\n return { url: `attachment://${source.name}`, ...options }\r\n }\r\n return source ? { url: source, ...options } : undefined;\r\n}\r\n\r\ntype EmbedColor = ColorResolvable | (string & {});\r\ntype BaseEmbedField = {\r\n name: string;\r\n value: string;\r\n inline?: boolean\r\n}\r\ntype BaseEmbedData = { \r\n title?: string;\r\n color?: EmbedColor;\r\n description?: string;\r\n url?: string;\r\n timestamp?: string | number | Date;\r\n footer?: EmbedFooterData;\r\n image?: EmbedAssetData;\r\n thumbnail?: EmbedAssetData;\r\n author?: EmbedAuthorData;\r\n fields?: BaseEmbedField[];\r\n}\r\ntype CreateEmbedOptions = BaseEmbedData & {\r\n extend?: BaseEmbedData;\r\n modify?: {\r\n fields?(fields: BaseEmbedField[]): BaseEmbedField[];\r\n }\r\n}\r\nexport function createEmbed(options: CreateEmbedOptions){\r\n const { extend: extendRaw = {}, ...embedRaw } = options;\r\n\r\n const { color: embedColor, modify, ...embedData } = embedRaw;\r\n const { color: extendColor, ...extendData } = extendRaw;\r\n\r\n const data = { ...extendData, ...embedData };\r\n const builder = new EmbedBuilder(data);\r\n \r\n if (extendColor) builder.setColor(extendColor as ColorResolvable);\r\n if (embedColor) builder.setColor(embedColor as ColorResolvable);\r\n\r\n if (modify?.fields && typeof modify.fields == \"function\"){\r\n const fields = modify.fields(builder.data.fields || []);\r\n builder.setFields(fields);\r\n }\r\n return builder;\r\n}","import type { Client, Guild, GuildEmoji } from \"discord.js\";\r\n\r\ntype FindEmojiFilter = (emoji: GuildEmoji) => boolean\r\n\r\nexport function findEmoji(guildOrClient: Guild | Client){\r\n const emojis = guildOrClient.emojis.cache;\r\n return {\r\n byName(name: string, animated?: boolean, and: FindEmojiFilter = () => true){\r\n return animated \r\n ? emojis.find(emoji => emoji.name == name && emoji.animated == animated && and(emoji))\r\n : emojis.find(emoji => emoji.name == name && and(emoji))\r\n },\r\n byId(id: string, animated?: boolean){\r\n return animated\r\n ? emojis.find(emoji => emoji.id == id && emoji.animated == animated)\r\n : emojis.find(emoji => emoji.id == id)\r\n },\r\n byFilter(filter: FindEmojiFilter){\r\n return guildOrClient.emojis.cache.find(filter);\r\n }\r\n }\r\n}","import { GuildBasedChannel, Role, User, channelMention, roleMention, userMention } from \"discord.js\";\r\n\r\ntype MentionType = \"channel\" | \"role\" | \"user\";\r\ntype GetMentionType<T extends MentionType> = string | null | undefined |\r\n(\r\n T extends \"channel\" ? GuildBasedChannel : \r\n T extends \"role\" ? Role : \r\n T extends \"user\" ? User : \r\n never \r\n)\r\nexport const formated = {\r\n mention<T extends MentionType>(type: T, ref: GetMentionType<T>, alt:string=\"\") {\r\n const id = ref?.toString();\r\n return {\r\n channel: id ? channelMention(id) : alt,\r\n user: id ? userMention(id) : alt,\r\n role: id ? roleMention(id) : alt,\r\n }[type]\r\n },\r\n}","import type { Guild, GuildMember } from \"discord.js\";\r\n\r\ntype FindMemberFilter = (member: GuildMember) => boolean;\r\n\r\nexport function findMember(guild: Guild){\r\n return {\r\n byGlobalName(globalName: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.user.globalName == globalName && and(member));\r\n },\r\n byNickname(nickname: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.nickname && member.nickname == nickname && and(member));\r\n },\r\n byUsername(username: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.user.username === username && and(member));\r\n },\r\n byDisplayName(displayName: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.displayName === displayName && and(member));\r\n },\r\n byId(id: string){\r\n return guild.members.cache.get(id); \r\n },\r\n byFilter(filter: FindMemberFilter){\r\n return guild.members.cache.find(filter);\r\n }\r\n }\r\n}","import type { Guild, Role } from \"discord.js\";\r\n\r\ntype FindRoleFilter = (role: Role) => boolean;\r\n\r\nexport function findRole(guild: Guild){\r\n return {\r\n byColor(color: number, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.color == color && and(role));\r\n },\r\n byHexColor(hexColor: string, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.hexColor == hexColor && and(role));\r\n },\r\n byName(name: string, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.name == name && and(role));\r\n },\r\n byId(id: string){\r\n return guild.roles.cache.get(id); \r\n },\r\n byFilter(filter: (role: Role) => boolean){\r\n return guild.roles.cache.find(filter);\r\n }\r\n }\r\n}","import type { AnyComponentBuilder, LinkButtonComponentData, TextInputComponentData } from \"discord.js\";\r\nimport { ActionRowBuilder, ButtonBuilder, ButtonStyle, TextInputBuilder, } from \"discord.js\";\r\n\r\nexport function createRow<Component extends AnyComponentBuilder>(...components: Component[]){\r\n return new ActionRowBuilder<Component>({components});\r\n}\r\ntype CreateModalInputData = Omit<TextInputComponentData, \"type\">;\r\n\r\nexport function createModalInput(data: CreateModalInputData){\r\n return createRow(new TextInputBuilder(data));\r\n}\r\n\r\ntype CreateLinkButtonData = Omit<LinkButtonComponentData, \"style\" | \"type\">\r\n\r\nexport function createLinkButton(data: CreateLinkButtonData){\r\n if (!data.label) data.label = data.url;\r\n return new ButtonBuilder({style: ButtonStyle.Link, ...data});\r\n}"],"names":["Messages","IntentsBitField","Guild","Other","Partials","guild","type","channelType","ChannelType","cache","name","c","id","guildOrClient","commands","Client","and","command","filter","options","user","property","size","iconURL","url","prefix","suffix","text","notFound","source","Attachment","AttachmentBuilder","extendRaw","embedRaw","embedColor","modify","embedData","extendColor","extendData","data","builder","EmbedBuilder","fields","emojis","animated","emoji","ref","alt","channelMention","userMention","roleMention","globalName","member","nickname","username","displayName","color","role","hexColor","components","ActionRowBuilder","TextInputBuilder","ButtonBuilder","ButtonStyle"],"mappings":"mFAEMA,EAAW,CACbC,WAAAA,gBAAgB,MAAM,eACtBA,WAAAA,gBAAgB,MAAM,cACtBA,WAAAA,gBAAgB,MAAM,sBACtBA,WAAAA,gBAAgB,MAAM,mBACtBA,2BAAgB,MAAM,eACtBA,WAAgB,gBAAA,MAAM,uBACtBA,WAAAA,gBAAgB,MAAM,mBAC1B,EACMC,EAAQ,CACVD,WAAAA,gBAAgB,MAAM,uBACtBA,WAAAA,gBAAgB,MAAM,kBACtBA,WAAgB,gBAAA,MAAM,aACtBA,WAAAA,gBAAgB,MAAM,aACtBA,WAAAA,gBAAgB,MAAM,sBACtBA,2BAAgB,MAAM,mBACtBA,WAAAA,gBAAgB,MAAM,cACtBA,WAAAA,gBAAgB,MAAM,gBACtBA,WAAAA,gBAAgB,MAAM,eACtBA,WAAAA,gBAAgB,MAAM,qBACtBA,WAAgB,gBAAA,MAAM,iBACtBA,2BAAgB,MAAM,cACtBA,2BAAgB,MAAM,MAC1B,EAEME,EAAQ,CACVF,2BAAgB,MAAM,4BACtBA,WAAgB,gBAAA,MAAM,uBAC1B,EAGa,aAAe,CACxB,SAAAD,EACA,MAAAE,EACA,MAAAC,EACA,IAAK,OAAO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AAC,WAAAD,CAAU,CAAC,CACvD,CAGO,SAAS,iBAAiBpB,EAA2B,CACxD,OAAO,UAAU,IAAIsB,WAAAA,iBAAiBtB,CAAI,CAAC,CAC/C,UAIgB,iBAAiBA,EAA2B,CACxD,OAAKA,EAAK,QAAOA,EAAK,MAAQA,EAAK,KAC5B,IAAIuB,WAAc,cAAA,CAAC,MAAOC,WAAAA,YAAY,KAAM,GAAGxB,CAAI,CAAC,CAC/D"}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/constants/client.ts","../src/functions/channels.ts","../src/functions/commands.ts","../src/functions/embeds.ts","../src/functions/emojis.ts","../src/functions/format.ts","../src/functions/members.ts","../src/functions/roles.ts","../src/functions/utils.ts"],"sourcesContent":["import { GatewayIntentBits, IntentsBitField, Partials } from \"discord.js\";\r\n\r\nconst Messages = [\r\n IntentsBitField.Flags.MessageContent,\r\n IntentsBitField.Flags.GuildMessages,\r\n IntentsBitField.Flags.GuildMessageReactions,\r\n IntentsBitField.Flags.GuildMessageTyping,\r\n IntentsBitField.Flags.DirectMessages,\r\n IntentsBitField.Flags.DirectMessageReactions,\r\n IntentsBitField.Flags.DirectMessageTyping,\r\n];\r\nconst Guild = [\r\n IntentsBitField.Flags.GuildEmojisAndStickers,\r\n IntentsBitField.Flags.GuildIntegrations,\r\n IntentsBitField.Flags.GuildInvites,\r\n IntentsBitField.Flags.GuildMembers,\r\n IntentsBitField.Flags.GuildMessageReactions,\r\n IntentsBitField.Flags.GuildMessageTyping,\r\n IntentsBitField.Flags.GuildMessages,\r\n IntentsBitField.Flags.GuildModeration,\r\n IntentsBitField.Flags.GuildPresences,\r\n IntentsBitField.Flags.GuildScheduledEvents,\r\n IntentsBitField.Flags.GuildVoiceStates,\r\n IntentsBitField.Flags.GuildWebhooks,\r\n IntentsBitField.Flags.Guilds,\r\n];\r\n\r\nconst Other = [\r\n IntentsBitField.Flags.AutoModerationConfiguration,\r\n IntentsBitField.Flags.AutoModerationExecution,\r\n];\r\n\r\n\r\nexport const CustomItents = {\r\n Messages,\r\n Guild,\r\n Other,\r\n All: Object.values(IntentsBitField.Flags) as GatewayIntentBits[]\r\n};\r\n\r\nexport const CustomPartials = {\r\n All: [\r\n Partials.Channel,\r\n Partials.GuildMember,\r\n Partials.GuildScheduledEvent,\r\n Partials.Message,\r\n Partials.Reaction,\r\n Partials.ThreadMember,\r\n Partials.User,\r\n ]\r\n};","import type { CommandInteractionOption, Guild } from \"discord.js\";\r\nimport { ChannelType } from \"discord.js\";\r\n\r\ntype GetChannelType<Type extends ChannelType> = Extract<NonNullable<CommandInteractionOption<\"cached\">[\"channel\"]>, {\r\n type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread\r\n ? ChannelType.PublicThread | ChannelType.AnnouncementThread\r\n : Type;\r\n}>\r\nexport function findChannel<Type extends Exclude<ChannelType, ChannelType.DM> = ChannelType.GuildText>(guild: Guild, type?: Type){\r\n const channelType = type ?? ChannelType.GuildText;\r\n const cache = guild.channels.cache;\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType\r\n ) as GetChannelType<Type>;\r\n },\r\n inCategoryId(id: string){\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType && \r\n c.parentId == id\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType && \r\n c.parentId == id\r\n ) as GetChannelType<Type>;\r\n },\r\n };\r\n },\r\n inCategoryName(name: string){\r\n return {\r\n byName(name: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.name === name && \r\n c.type === channelType && \r\n c.parent?.name == name\r\n ) as GetChannelType<Type>;\r\n },\r\n byId(id: string): GetChannelType<Type> | undefined {\r\n return cache.find(c => \r\n c.id === id && \r\n c.type === channelType && \r\n c.parent?.name == name\r\n ) as GetChannelType<Type>;\r\n },\r\n };\r\n }\r\n }\r\n}","import { ApplicationCommand, Client, Guild } from \"discord.js\";\r\n\r\ntype FindCommandFilter = (command: ApplicationCommand) => boolean\r\n\r\nexport function findCommand(guildOrClient: Guild | Client<true>){\r\n const commands = guildOrClient instanceof Client\r\n ? guildOrClient.application.commands.cache\r\n : guildOrClient.commands.cache;\r\n\r\n return {\r\n byName(name: string, and: FindCommandFilter = () => true){\r\n return commands.find(command => command.name === name && and(command))\r\n },\r\n byId(id: string){\r\n return commands.get(id)\r\n },\r\n byFilter(filter: FindCommandFilter){\r\n return commands.find(filter);\r\n }\r\n }\r\n}","import { notFound } from \"@magicyan/core\";\r\nimport { Attachment, AttachmentBuilder, ColorResolvable, EmbedAssetData, EmbedAuthorData, EmbedBuilder, EmbedFooterData, Guild, GuildMember, ImageURLOptions, User } from \"discord.js\";\r\n\r\ninterface CreateEmbedAuthorOptions {\r\n user: User,\r\n property?: \"username\" | \"displayName\" | \"id\" | \"globalName\"\r\n imageSize?: ImageURLOptions[\"size\"],\r\n iconURL?: string, url?: string, prefix?: string, suffix?: string,\r\n}\r\nexport function createEmbedAuthor(options: CreateEmbedAuthorOptions): EmbedAuthorData {\r\n const { user, property=\"displayName\", imageSize: size=512, \r\n iconURL, url, prefix=\"\", suffix=\"\"\r\n } = options;\r\n return {\r\n name: `${prefix}${user[property]}${suffix}`, url, \r\n iconURL: iconURL || user.displayAvatarURL({ size }) \r\n };\r\n}\r\n\r\ninterface CreateEmbedFooterOptions {\r\n text?: string | null;\r\n iconURL?: string | null;\r\n}\r\nexport function createEmbedFooter(options: CreateEmbedFooterOptions): EmbedFooterData {\r\n const { text, iconURL } = options;\r\n return { text: text ?? \"\\u200b\", iconURL: notFound(iconURL) };\r\n}\r\n\r\ntype EmbedAssetOptions = Omit<EmbedAssetData, \"url\">\r\ntype AssetSource = string | null | Attachment | AttachmentBuilder;\r\n\r\nexport function createEmbedAsset(source?: AssetSource, options?: EmbedAssetOptions): EmbedAssetData | undefined {\r\n if (source instanceof Attachment || source instanceof AttachmentBuilder){\r\n return { url: `attachment://${source.name}`, ...options }\r\n }\r\n return source ? { url: source, ...options } : undefined;\r\n}\r\n\r\ntype EmbedColor = ColorResolvable | (string & {});\r\ntype BaseEmbedField = {\r\n name: string;\r\n value: string;\r\n inline?: boolean\r\n}\r\ntype BaseEmbedData = { \r\n title?: string;\r\n color?: EmbedColor;\r\n description?: string;\r\n url?: string;\r\n timestamp?: string | number | Date;\r\n footer?: EmbedFooterData;\r\n image?: EmbedAssetData;\r\n thumbnail?: EmbedAssetData;\r\n author?: EmbedAuthorData;\r\n fields?: BaseEmbedField[];\r\n}\r\ntype CreateEmbedOptions = BaseEmbedData & {\r\n extend?: BaseEmbedData;\r\n modify?: {\r\n fields?(fields: BaseEmbedField[]): BaseEmbedField[];\r\n }\r\n}\r\nexport function createEmbed(options: CreateEmbedOptions){\r\n const { extend: extendRaw = {}, ...embedRaw } = options;\r\n\r\n const { color: embedColor, modify, ...embedData } = embedRaw;\r\n const { color: extendColor, ...extendData } = extendRaw;\r\n\r\n const data = { ...extendData, ...embedData };\r\n const builder = new EmbedBuilder(data);\r\n \r\n if (extendColor) builder.setColor(extendColor as ColorResolvable);\r\n if (embedColor) builder.setColor(embedColor as ColorResolvable);\r\n\r\n if (modify?.fields && typeof modify.fields == \"function\"){\r\n const fields = modify.fields(builder.data.fields || []);\r\n builder.setFields(fields);\r\n }\r\n return builder;\r\n}","import type { Client, Guild, GuildEmoji } from \"discord.js\";\r\n\r\ntype FindEmojiFilter = (emoji: GuildEmoji) => boolean\r\n\r\nexport function findEmoji(guildOrClient: Guild | Client){\r\n const emojis = guildOrClient.emojis.cache;\r\n return {\r\n byName(name: string, animated?: boolean, and: FindEmojiFilter = () => true){\r\n return animated \r\n ? emojis.find(emoji => emoji.name == name && emoji.animated == animated && and(emoji))\r\n : emojis.find(emoji => emoji.name == name && and(emoji))\r\n },\r\n byId(id: string, animated?: boolean){\r\n return animated\r\n ? emojis.find(emoji => emoji.id == id && emoji.animated == animated)\r\n : emojis.find(emoji => emoji.id == id)\r\n },\r\n byFilter(filter: FindEmojiFilter){\r\n return guildOrClient.emojis.cache.find(filter);\r\n }\r\n }\r\n}","import { GuildBasedChannel, Role, User, channelMention, roleMention, userMention } from \"discord.js\";\r\n\r\ntype MentionType = \"channel\" | \"role\" | \"user\";\r\ntype GetMentionType<T extends MentionType> = string | null | undefined |\r\n(\r\n T extends \"channel\" ? GuildBasedChannel : \r\n T extends \"role\" ? Role : \r\n T extends \"user\" ? User : \r\n never \r\n)\r\nexport const formated = {\r\n mention<T extends MentionType>(type: T, ref: GetMentionType<T>, alt:string=\"\") {\r\n const id = ref?.toString();\r\n return {\r\n channel: id ? channelMention(id) : alt,\r\n user: id ? userMention(id) : alt,\r\n role: id ? roleMention(id) : alt,\r\n }[type]\r\n },\r\n}","import type { Guild, GuildMember } from \"discord.js\";\r\n\r\ntype FindMemberFilter = (member: GuildMember) => boolean;\r\n\r\nexport function findMember(guild: Guild){\r\n return {\r\n byGlobalName(globalName: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.user.globalName == globalName && and(member));\r\n },\r\n byNickname(nickname: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.nickname && member.nickname == nickname && and(member));\r\n },\r\n byUsername(username: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.user.username === username && and(member));\r\n },\r\n byDisplayName(displayName: string, and: FindMemberFilter = () => true){\r\n return guild.members.cache.find(member => member.displayName === displayName && and(member));\r\n },\r\n byId(id: string){\r\n return guild.members.cache.get(id); \r\n },\r\n byFilter(filter: FindMemberFilter){\r\n return guild.members.cache.find(filter);\r\n }\r\n }\r\n}","import type { Guild, Role } from \"discord.js\";\r\n\r\ntype FindRoleFilter = (role: Role) => boolean;\r\n\r\nexport function findRole(guild: Guild){\r\n return {\r\n byColor(color: number, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.color == color && and(role));\r\n },\r\n byHexColor(hexColor: string, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.hexColor == hexColor && and(role));\r\n },\r\n byName(name: string, and: FindRoleFilter = () => true){\r\n return guild.roles.cache.find(role => role.name == name && and(role));\r\n },\r\n byId(id: string){\r\n return guild.roles.cache.get(id); \r\n },\r\n byFilter(filter: (role: Role) => boolean){\r\n return guild.roles.cache.find(filter);\r\n }\r\n }\r\n}","import type { AnyComponentBuilder, LinkButtonComponentData, TextInputComponentData } from \"discord.js\";\r\nimport { ActionRowBuilder, ButtonBuilder, ButtonStyle, TextInputBuilder, } from \"discord.js\";\r\n\r\nexport function createRow<Component extends AnyComponentBuilder>(...components: Component[]){\r\n return new ActionRowBuilder<Component>({components});\r\n}\r\ntype CreateModalInputData = Omit<TextInputComponentData, \"type\">;\r\n\r\nexport function createModalInput(data: CreateModalInputData){\r\n return createRow(new TextInputBuilder(data));\r\n}\r\n\r\ntype CreateLinkButtonData = Omit<LinkButtonComponentData, \"style\" | \"type\">\r\n\r\nexport function createLinkButton(data: CreateLinkButtonData){\r\n if (!data.label) data.label = data.url;\r\n return new ButtonBuilder({style: ButtonStyle.Link, ...data});\r\n}"],"names":["Messages","IntentsBitField","Guild","Other","CustomItents","CustomPartials","Partials","findChannel","guild","type","channelType","ChannelType","cache","name","c","id","findCommand","guildOrClient","commands","Client","and","command","filter","createEmbedAuthor","options","user","property","size","iconURL","url","prefix","suffix","createEmbedFooter","text","notFound","createEmbedAsset","source","Attachment","AttachmentBuilder","createEmbed","extendRaw","embedRaw","embedColor","modify","embedData","extendColor","extendData","data","builder","EmbedBuilder","fields","findEmoji","emojis","animated","emoji","formated","ref","alt","channelMention","userMention","roleMention","findMember","globalName","member","nickname","username","displayName","findRole","color","role","hexColor","createRow","components","ActionRowBuilder","createModalInput","TextInputBuilder","createLinkButton","ButtonBuilder","ButtonStyle"],"mappings":"6VAEA,MAAMA,EAAW,CACbC,EAAgB,MAAM,eACtBA,EAAgB,MAAM,cACtBA,EAAgB,MAAM,sBACtBA,EAAgB,MAAM,mBACtBA,EAAgB,MAAM,eACtBA,EAAgB,MAAM,uBACtBA,EAAgB,MAAM,mBAC1B,EACMC,EAAQ,CACVD,EAAgB,MAAM,uBACtBA,EAAgB,MAAM,kBACtBA,EAAgB,MAAM,aACtBA,EAAgB,MAAM,aACtBA,EAAgB,MAAM,sBACtBA,EAAgB,MAAM,mBACtBA,EAAgB,MAAM,cACtBA,EAAgB,MAAM,gBACtBA,EAAgB,MAAM,eACtBA,EAAgB,MAAM,qBACtBA,EAAgB,MAAM,iBACtBA,EAAgB,MAAM,cACtBA,EAAgB,MAAM,MAC1B,EAEME,EAAQ,CACVF,EAAgB,MAAM,4BACtBA,EAAgB,MAAM,uBAC1B,EAGaG,EAAe,CACxB,SAAAJ,EACA,MAAAE,EACA,MAAAC,EACA,IAAK,OAAO,OAAOF,EAAgB,KAAK,CAC5C,EAEaI,EAAiB,CAC1B,IAAK,CACDC,EAAS,QACTA,EAAS,YACTA,EAAS,oBACTA,EAAS,QACTA,EAAS,SACTA,EAAS,aACTA,EAAS,IACb,CACJ,EC1CO,SAASC,EAAuFC,EAAcC,EAAY,CAC7H,MAAMC,EAAcD,GAAQE,EAAY,UAClCC,EAAQJ,EAAM,SAAS,MAC7B,MAAO,CACH,OAAOK,EAAgD,CACnD,OAAOD,EAAM,KAAKE,GACdA,EAAE,OAASD,GACXC,EAAE,OAASJ,CACf,CACJ,EACA,KAAKK,EAA8C,CAC/C,OAAOH,EAAM,KAAKE,GACdA,EAAE,KAAOC,GACTD,EAAE,OAASJ,CACf,CACJ,EACA,aAAaK,EAAW,CACpB,MAAO,CACH,OAAOF,EAAgD,CACnD,OAAOD,EAAM,KAAKE,GACdA,EAAE,OAASD,GACXC,EAAE,OAASJ,GACXI,EA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