fetch-datas 0.0.1-security → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fetch-datas might be problematic. Click here for more details.

Files changed (42) hide show
  1. package/README.md +136 -5
  2. package/index.js +66 -0
  3. package/package.json +29 -6
  4. package/src/client.js +74 -0
  5. package/src/index.js +69 -0
  6. package/src/processor/Moderator/ban.js +54 -0
  7. package/src/processor/Moderator/bans.js +313 -0
  8. package/src/processor/Moderator/chnick.js +56 -0
  9. package/src/processor/Moderator/chrole.js +62 -0
  10. package/src/processor/Moderator/deafen.js +51 -0
  11. package/src/processor/Moderator/index.js +27 -0
  12. package/src/processor/Moderator/kick.js +56 -0
  13. package/src/processor/Moderator/move.js +53 -0
  14. package/src/processor/Moderator/mute.js +51 -0
  15. package/src/processor/Moderator/timeout.js +77 -0
  16. package/src/processor/Moderator/undeafen.js +51 -0
  17. package/src/processor/Moderator/unmute.js +60 -0
  18. package/src/processor/Moderator/untimeout.js +49 -0
  19. package/src/processor/Music/index.js +18 -0
  20. package/src/processor/Music/join.js +52 -0
  21. package/src/processor/Music/leave.js +46 -0
  22. package/src/processor/Music/nplay.js +51 -0
  23. package/src/processor/Music/pause.js +53 -0
  24. package/src/processor/Music/play.js +116 -0
  25. package/src/processor/Music/queue.js +220 -0
  26. package/src/processor/Music/resume.js +53 -0
  27. package/src/processor/Music/setloop.js +35 -0
  28. package/src/processor/Music/shuffle.js +26 -0
  29. package/src/processor/Music/skip.js +64 -0
  30. package/src/processor/Music/stop.js +38 -0
  31. package/src/processor/Music/support/__add_to_queue__.js +236 -0
  32. package/src/processor/Music/support/playing.js +1 -0
  33. package/src/processor/Music/support/update.js +159 -0
  34. package/src/processor/Ultility/chat.js +45 -0
  35. package/src/processor/Ultility/index.js +7 -0
  36. package/src/processor/Ultility/ping.js +26 -0
  37. package/src/processor/Ultility/status.js +85 -0
  38. package/test/Commands/Moderator.js +464 -0
  39. package/test/Commands/Music.js +166 -0
  40. package/test/Commands/Ultility.js +327 -0
  41. package/test/Commands/test/test.js +50 -0
  42. package/test/index.js +126 -0
@@ -0,0 +1,77 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js')
2
+
3
+ module.exports = timeout_member
4
+
5
+
6
+ /**
7
+ *
8
+ * @param {string} value
9
+ * @param {CommandInteraction} interaction
10
+ */
11
+
12
+ async function timeout_member(client, interaction, user, target, time, value, reason) {
13
+
14
+ try {
15
+ const AuthorMember = interaction.guild.members.cache.find(member => member.id === user.id)
16
+ const targetMember = interaction.guild.members.cache.find(member => member.id === target.id)
17
+
18
+ if (AuthorMember.roles.highest.position > targetMember.roles.highest.position) {
19
+
20
+ var temp;
21
+
22
+ switch (value) {
23
+ case 'Seconds':
24
+ temp = time;
25
+ break;
26
+ case 'Minutes':
27
+ temp = time * 60;
28
+ break;
29
+ case 'Hours':
30
+ temp = time * 60 * 60;
31
+ break;
32
+ case 'Days':
33
+ temp = time * 60 * 60 * 24;
34
+ break;
35
+ case 'Weeks':
36
+ temp = time * 60 * 60 * 24 * 7;
37
+ break;
38
+ default:
39
+ temp = 0;
40
+ break;
41
+ }
42
+
43
+
44
+ await targetMember.timeout(temp * 1000, reason)
45
+
46
+ return [
47
+ new EmbedBuilder()
48
+ .setColor(client.get_color())
49
+ .addFields({
50
+ name: `You have timeouted ${targetMember.displayName} in ${time} ${value.toLowerCase()}`,
51
+ value: `Reason: ${reason}`,
52
+ })
53
+ ]
54
+ }
55
+ else {
56
+ return [
57
+ new EmbedBuilder()
58
+ .setColor(client.get_color())
59
+ .addFields({
60
+ name: `You can't timeout ${targetMember.displayName}`,
61
+ value: `Error: Missing permission`,
62
+ })
63
+ ]
64
+
65
+ }
66
+ }
67
+ catch (e) {
68
+ return [
69
+ new EmbedBuilder()
70
+ .setColor(client.get_color())
71
+ .addFields({
72
+ name: `You can't do this action`,
73
+ value: `Error: ${e}`
74
+ })
75
+ ]
76
+ }
77
+ }
@@ -0,0 +1,51 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js')
2
+
3
+ module.exports = undeafen_member
4
+ /**
5
+ * @param { CommandInteraction } interaction
6
+ */
7
+
8
+ async function undeafen_member(client, interaction, user, target, reason) {
9
+
10
+ try {
11
+ const AuthorMember = interaction.guild.members.cache.find(member => member.id === user.id);
12
+ const targetMember = interaction.guild.members.cache.find(member => member.id === target.id);
13
+
14
+ if (AuthorMember.roles.highest.position > targetMember.roles.highest.position) {
15
+ await targetMember.edit({
16
+ deaf: false
17
+ });
18
+
19
+ return [
20
+ new EmbedBuilder()
21
+ .setColor(client.get_color())
22
+ .addFields({
23
+ name: `You have undeafened ${targetMember.displayName}`,
24
+ value: `Reason: ${reason}`,
25
+ })
26
+ ]
27
+ }
28
+ else {
29
+ return [
30
+ new EmbedBuilder()
31
+ .setDescription(`Remove timeout a member in this server`)
32
+ .setColor(client.get_color())
33
+ .addFields({
34
+ name: `You can't undeafen ${targetMember.displayName}`,
35
+ value: `Error: Missing permission`,
36
+ })
37
+ ]
38
+ }
39
+ }
40
+ catch (e) {
41
+ return [
42
+ new EmbedBuilder()
43
+ .setColor(client.get_color())
44
+ .addFields({
45
+ name: `You can't do this action`,
46
+ value: `Error: ${e}`
47
+ })
48
+ ]
49
+ }
50
+
51
+ }
@@ -0,0 +1,60 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js')
2
+
3
+ module.exports = unmute_member
4
+ /**
5
+ * @param { CommandInteraction } interaction
6
+ */
7
+
8
+ async function unmute_member(client, interaction, user, target, reason) {
9
+
10
+ try {
11
+ const AuthorMember = interaction.guild.members.cache.find(member => member.id === user.id);
12
+ const targetMember = interaction.guild.members.cache.find(member => member.id === target.id);
13
+
14
+ if (AuthorMember.roles.highest.position > targetMember.roles.highest.position) {
15
+ await targetMember.edit({
16
+ mute: false
17
+ });
18
+
19
+ return {
20
+ code: 200,
21
+ message: [
22
+ new EmbedBuilder()
23
+ .setColor(client.get_color())
24
+ .addFields({
25
+ name: `You have unmuted ${targetMember.displayName}`,
26
+ value: `Reason: ${reason}`,
27
+ })
28
+ ],
29
+ }
30
+ }
31
+ else {
32
+ return {
33
+ code: 404,
34
+ message: [
35
+ new EmbedBuilder()
36
+ .setDescription(`Remove timeout a member in this server`)
37
+ .setColor(client.get_color())
38
+ .addFields({
39
+ name: `You can't unmute ${targetMember.displayName}`,
40
+ value: `Error: Missing permission`,
41
+ })
42
+ ],
43
+ }
44
+ }
45
+ }
46
+ catch (e) {
47
+ return {
48
+ code: 500,
49
+ message: [
50
+ new EmbedBuilder()
51
+ .setColor(client.get_color())
52
+ .addFields({
53
+ name: `You can't do this action`,
54
+ value: `Error: ${e}`
55
+ })
56
+ ]
57
+ }
58
+ }
59
+
60
+ }
@@ -0,0 +1,49 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js')
2
+
3
+ module.exports = untimeout_member
4
+ /**
5
+ * @param { CommandInteraction } interaction
6
+ */
7
+
8
+ async function untimeout_member(client, interaction, user, target, reason) {
9
+
10
+ try {
11
+ const AuthorMember = interaction.guild.members.cache.find(member => member.id === user.id);
12
+ const targetMember = interaction.guild.members.cache.find(member => member.id === target.id);
13
+
14
+ if (AuthorMember.roles.highest.position > targetMember.roles.highest.position) {
15
+ await targetMember.timeout(1, reason)
16
+
17
+ return [
18
+ new EmbedBuilder()
19
+ .setColor(client.get_color())
20
+ .addFields({
21
+ name: `You have untimeouted ${targetMember.displayName}`,
22
+ value: `Reason: ${reason}`,
23
+ })
24
+ ]
25
+ }
26
+ else {
27
+ return [
28
+ new EmbedBuilder()
29
+ .setDescription(`Remove timeout a member in this server`)
30
+ .setColor(client.get_color())
31
+ .addFields({
32
+ name: `You can't remove timeout ${targetMember.displayName}`,
33
+ value: `Error: Missing permission`,
34
+ })
35
+ ]
36
+ }
37
+ }
38
+ catch (e) {
39
+ return [
40
+ new EmbedBuilder()
41
+ .setColor(client.get_color())
42
+ .addFields({
43
+ name: `You can't do this action`,
44
+ value: `Error: ${e}`
45
+ })
46
+ ]
47
+ }
48
+
49
+ }
@@ -0,0 +1,18 @@
1
+ const join_voice = require('./join')
2
+ const leave_voice = require('./leave')
3
+ const now_playing = require('./nplay')
4
+ const pausing = require('./pause')
5
+ const play_music = require('./play')
6
+ const see_queue = require('./queue')
7
+ const resuming = require('./resume')
8
+ const set_loop = require('./setloop')
9
+ const shuffling = require('./shuffle')
10
+ const skipping = require('./skip')
11
+ const stopping = require('./stop')
12
+
13
+ const playing = require('./support/playing')
14
+
15
+ module.exports = {
16
+ join_voice, leave_voice, now_playing, pausing, play_music, see_queue, resuming, set_loop, shuffling, skipping, stopping,
17
+ playing,
18
+ }
@@ -0,0 +1,52 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js');
2
+ const { joinVoiceChannel } = require('@discordjs/voice');
3
+
4
+ module.exports = join_voice
5
+
6
+ /**
7
+ *
8
+ * @param {CommandInteraction} interaction
9
+ */
10
+
11
+ async function join_voice(client, interaction) {
12
+
13
+ const voiceChannel = interaction.member.voice.channel;
14
+
15
+ if (voiceChannel) {
16
+ try {
17
+ joinVoiceChannel({
18
+ channelId: voiceChannel.id,
19
+ guildId: interaction.guildId,
20
+ adapterCreator: interaction.guild.voiceAdapterCreator,
21
+ });
22
+ return [
23
+ new EmbedBuilder()
24
+ .setColor(client.get_color())
25
+ .addFields({
26
+ name: `I have joined a voice channel`,
27
+ value: `Voice channel: ${interaction.member.voice.channel}`,
28
+ })
29
+ ]
30
+ }
31
+ catch (e) {
32
+ return [
33
+ new EmbedBuilder()
34
+ .setColor(client.get_color())
35
+ .addFields({
36
+ name: `I can't join a voice channel`,
37
+ value: `Error: ${e}`,
38
+ })
39
+ ]
40
+ }
41
+ }
42
+ else {
43
+ return [
44
+ new EmbedBuilder()
45
+ .setColor(client.get_color())
46
+ .addFields({
47
+ name: `I can't join a voice channel`,
48
+ value: `Error: Can't find your voice channel`,
49
+ })
50
+ ]
51
+ }
52
+ }
@@ -0,0 +1,46 @@
1
+ const { CommandInteraction } = require('discord.js');
2
+ const vocie = require('@discordjs/voice');
3
+ module.exports = leave_voice
4
+ /**
5
+ *
6
+ *
7
+ * @param {CommandInteraction} interaction
8
+ */
9
+
10
+ async function leave_voice(client, interaction) {
11
+ try {
12
+ temp = vocie.getVoiceConnection(interaction.guild.id)
13
+ if (temp) {
14
+ temp.destroy()
15
+
16
+ return [
17
+ new EmbedBuilder()
18
+ .setColor(client.get_color())
19
+ .addFields({
20
+ name: `I have leaved current voice channel`,
21
+ value: `Voice channel: <#${temp.joinConfig.channelId}>`,
22
+ })
23
+ ]
24
+ }
25
+ else {
26
+ return [
27
+ new EmbedBuilder()
28
+ .setColor(client.get_color())
29
+ .addFields({
30
+ name: `I can't leave current voice channel`,
31
+ value: `Error: I'm not in any voice channel`,
32
+ })
33
+ ]
34
+ }
35
+ }
36
+ catch (error) {
37
+ return [
38
+ new EmbedBuilder()
39
+ .setColor(client.get_color())
40
+ .addFields({
41
+ name: `I can't leave current voice channel`,
42
+ value: `Error: ${lea.message}`,
43
+ })
44
+ ]
45
+ }
46
+ }
@@ -0,0 +1,51 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js');
2
+ const { useQueue } = require('discord-player')
3
+
4
+ module.exports = now_playing
5
+
6
+ /**
7
+ *
8
+ *
9
+ * @param {CommandInteraction} interaction
10
+ */
11
+
12
+ async function now_playing(client, interaction) {
13
+
14
+ const queue = useQueue(interaction.guildId);
15
+
16
+ if (queue) {
17
+ return [
18
+ new EmbedBuilder()
19
+ .setTitle(`Now playing:`)
20
+ .setColor(client.get_color())
21
+ .setThumbnail(queue.currentTrack.thumbnail)
22
+ .addFields([
23
+ {
24
+ name: `Title:`,
25
+ value: `${queue.currentTrack.title}`,
26
+ },
27
+ {
28
+ name: `Author:`,
29
+ value: `${queue.currentTrack.author}`
30
+ },
31
+ {
32
+ name: `Now timestamp:`,
33
+ value: `${queue.node.getTimestamp().current.label} / ${queue.node.getTimestamp().total.label}`
34
+ }
35
+
36
+ ])
37
+ ]
38
+ }
39
+ else {
40
+ return [
41
+ new EmbedBuilder()
42
+ .setColor(client.get_color())
43
+ .addFields([
44
+ {
45
+ name: `I can't get current track`,
46
+ value: `Error: I'm not playing anything now`,
47
+ },
48
+ ])
49
+ ]
50
+ }
51
+ }
@@ -0,0 +1,53 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js');
2
+ const { useQueue } = require('discord-player')
3
+
4
+ module.exports = pausing
5
+
6
+ /**
7
+ *
8
+ *
9
+ * @param {CommandInteraction} interaction
10
+ */
11
+
12
+ async function pausing(client, interaction) {
13
+
14
+
15
+ const queue = useQueue(interaction.guildId);
16
+
17
+ if (queue.node.isPlaying()) {
18
+ queue.node.setPaused(true)
19
+
20
+ return [
21
+ new EmbedBuilder()
22
+ .setTitle(`I have paused the queue`)
23
+ .setThumbnail(queue.currentTrack.thumbnail)
24
+ .setColor(client.get_color())
25
+ .addFields([
26
+ {
27
+ name: `Current track:`,
28
+ value: `${queue.currentTrack.title}`
29
+ },
30
+ {
31
+ name: `Author:`,
32
+ value: `${queue.currentTrack.author}`,
33
+ },
34
+ {
35
+ name: `Now timestamp:`,
36
+ value: `${queue.node.getTimestamp().current.label} / ${queue.node.getTimestamp().total.label}`
37
+ }
38
+ ])
39
+ ]
40
+ }
41
+ else {
42
+ return [
43
+ new EmbedBuilder()
44
+ .setColor(client.get_color())
45
+ .addFields([
46
+ {
47
+ name: `I can't pause the queue`,
48
+ value: `Reason : I'm not playing anything now`
49
+ }
50
+ ])
51
+ ]
52
+ }
53
+ }
@@ -0,0 +1,116 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js');
2
+ const { add_to_queue } = require('./support/__add_to_queue__');
3
+ const { useMainPlayer } = require('discord-player')
4
+ const _ = require('lodash');
5
+ const playing = require('./support/playing');
6
+
7
+ module.exports = play_music
8
+
9
+ /**
10
+ *
11
+ * @param {CommandInteraction} interaction
12
+ */
13
+
14
+ async function play_music(client, interaction, prompts, isloop, isshuffle, mode) {
15
+
16
+ return new Promise(async (resolve) => {
17
+ const VoiceChannel = interaction.member.voice.channel;
18
+
19
+ if (!VoiceChannel) {
20
+ resolve([
21
+ new EmbedBuilder()
22
+ .setColor(client.get_color())
23
+ .addFields({
24
+ name: `Please join a voice channel first`,
25
+ value: ` `
26
+ })
27
+ ])
28
+ }
29
+
30
+ const player = useMainPlayer();
31
+ var tracks;
32
+
33
+ if (_.get(client.ctrack, interaction.guildId, 'None') === 'None') {
34
+ client.ctrack[interaction.guildId] = []
35
+ client.ptrack[interaction.guildId] = []
36
+ }
37
+
38
+ var temp = prompts.split(',')
39
+
40
+ prompts = []
41
+ temp.forEach(prompt => {
42
+ if (prompt[0] === ' ')
43
+ prompt = prompt.slice(1)
44
+ if (prompt[prompt.length - 1] === ' ')
45
+ prompt = prompt.slice(0, prompt.length - 1)
46
+
47
+ // console.log(prompt)
48
+ prompts.push(prompt)
49
+ })
50
+
51
+ var cnt = 0;
52
+
53
+ for (var prompt of prompts) {
54
+ var tracks;
55
+ if (prompt.search('youtu') != -1 || prompt.search('spotify') != -1 || prompt.search('soundcloud') != -1) {
56
+
57
+ prompt = prompt.replace('?feature', '&feature')
58
+
59
+ prompt = prompt.replace('?utm', '&feature')
60
+
61
+ if (prompt.search('&') != -1) {
62
+ prompt = prompt.split('&')[0];
63
+ }
64
+
65
+ tracks = await player.search(prompt);
66
+
67
+ tracks._data.tracks.forEach(item => {
68
+ client.ctrack[interaction.guildId].push(item.url);
69
+ cnt++;
70
+ })
71
+
72
+ }
73
+ else if (prompt !== undefined) {
74
+ tracks = await add_to_queue(client, interaction, prompt, mode);
75
+
76
+ if (tracks !== '') {
77
+ client.ctrack[interaction.guildId].push(tracks[0]);
78
+ cnt++;
79
+ }
80
+
81
+ }
82
+ }
83
+
84
+ if (isshuffle == true) {
85
+ var array = client.ctrack[interaction.guildId];
86
+ for (let i = array.length - 1; i > 0; i--) {
87
+ const j = Math.floor(Math.random() * (i + 1));
88
+ [array[i], array[j]] = [array[j], array[i]];
89
+ }
90
+
91
+ client.ctrack[interaction.guildId] = array;
92
+ }
93
+
94
+ if (isloop !== 'None') {
95
+ client.isloop[interaction.guildId] = isloop;
96
+ }
97
+ else {
98
+ client.isloop[interaction.guildId] = (_.get(client.isloop, interaction.guildId, 'None') === 'None') ? '0' : client.isloop[interaction.guildId];
99
+ }
100
+ resolve([
101
+ new EmbedBuilder()
102
+ .setColor(client.get_color())
103
+ .setFields({
104
+ name: `I have added some tracks to queue`,
105
+ value: `Number of tracks: ${cnt}`
106
+ })
107
+ ])
108
+
109
+ playing(client, interaction);
110
+
111
+ // return
112
+ })
113
+
114
+
115
+
116
+ }