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,464 @@
1
+ const {
2
+ SlashCommandBuilder,
3
+ CommandInteraction,
4
+ PermissionFlagsBits,
5
+ } = require("discord.js");
6
+ const {
7
+ discordClient,
8
+ ban_member,
9
+ view_bans,
10
+ chnick_member,
11
+ chrole_member,
12
+ deafen_member,
13
+ kick_member,
14
+ mute_member,
15
+ timeout_member,
16
+ undeafen_member,
17
+ unmute_member,
18
+ untimeout_member,
19
+ move_member,
20
+ } = require("../../src/index");
21
+
22
+ module.exports = {
23
+ data: new SlashCommandBuilder()
24
+ .setName("moderator")
25
+ .setDescription("Moderate your server")
26
+ .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
27
+ .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
28
+ .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames)
29
+ .setDefaultMemberPermissions(PermissionFlagsBits.ManageRoles)
30
+ .setDefaultMemberPermissions(PermissionFlagsBits.DeafenMembers)
31
+ .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
32
+ .setDefaultMemberPermissions(PermissionFlagsBits.MuteMembers)
33
+ .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers)
34
+ .addSubcommand((scm) =>
35
+ scm
36
+ .setName("ban")
37
+ .setDescription("Ban a member! (only use slash command)")
38
+
39
+ .addUserOption((member) =>
40
+ member
41
+ .setName("member")
42
+ .setDescription("Who do you want to call?")
43
+ .setRequired(true)
44
+ )
45
+ .addStringOption((reason) =>
46
+ reason.setName("reason").setDescription("Why you want to do to that?")
47
+ )
48
+ )
49
+ .addSubcommand((scm) =>
50
+ scm
51
+ .setName("bans")
52
+ .setDescription(
53
+ "See bans list and unban member! (only use slash command)"
54
+ )
55
+ )
56
+ .addSubcommand((scm) =>
57
+ scm
58
+ .setName("chnick")
59
+ .setDescription(
60
+ "Change nickname for a member! (only use slash command)"
61
+ )
62
+ .addUserOption((member) =>
63
+ member
64
+ .setName("member")
65
+ .setDescription("Who do you want to call?")
66
+ .setRequired(true)
67
+ )
68
+ .addStringOption((nick) =>
69
+ nick.setName("nick").setDescription("what nick you want to change?")
70
+ )
71
+ )
72
+ .addSubcommand((scm) =>
73
+ scm
74
+ .setName("chrole")
75
+ .setDescription("Change role for a member! (only use slash command)")
76
+ .addUserOption((member) =>
77
+ member
78
+ .setName("member")
79
+ .setDescription("Who do you want to call?")
80
+ .setRequired(true)
81
+ )
82
+ .addRoleOption((role) =>
83
+ role.setName("role").setDescription("What role you want to change?")
84
+ )
85
+ )
86
+ .addSubcommand((scm) =>
87
+ scm
88
+ .setName("deafen")
89
+ .setDescription("deafen a member! (only use slash command)")
90
+
91
+ .addUserOption((option) =>
92
+ option
93
+ .setName("member")
94
+ .setDescription("Who do you want to call?")
95
+ .setRequired(true)
96
+ )
97
+ .addStringOption((option) =>
98
+ option.setName("reason").setDescription("Why you want to do to that?")
99
+ )
100
+ )
101
+ .addSubcommand((scm) =>
102
+ scm
103
+ .setName("kick")
104
+ .setDescription("Kick a member! (only use slash command)")
105
+ .addUserOption((member) =>
106
+ member
107
+ .setName("member")
108
+ .setDescription("Who do you want to call?")
109
+ .setRequired(true)
110
+ )
111
+ .addStringOption((reason) =>
112
+ reason.setName("reason").setDescription("Why you want to do to that?")
113
+ )
114
+ )
115
+ .addSubcommand((scm) =>
116
+ scm
117
+ .setName("mute")
118
+ .setDescription("mute a member! (only use slash command)")
119
+
120
+ .addUserOption((option) =>
121
+ option
122
+ .setName("member")
123
+ .setDescription("Who do you want to call?")
124
+ .setRequired(true)
125
+ )
126
+ .addStringOption((option) =>
127
+ option.setName("reason").setDescription("Why you want to do to that?")
128
+ )
129
+ )
130
+ .addSubcommand((scm) =>
131
+ scm
132
+ .setName("timeout")
133
+ .setDescription("Timeout a member! (only use slash command)")
134
+
135
+ .addUserOption((option) =>
136
+ option
137
+ .setName("member")
138
+ .setDescription("Who do you want to call?")
139
+ .setRequired(true)
140
+ )
141
+
142
+ .addIntegerOption((option) =>
143
+ option
144
+ .setName("time")
145
+ .setRequired(true)
146
+ .setDescription("How long you want to timeout?")
147
+ )
148
+ .addStringOption((option) =>
149
+ option
150
+ .setName("value")
151
+ .setDescription("Time Unit")
152
+ .setRequired(true)
153
+ .addChoices(
154
+ { name: "Seconds", value: "Seconds" },
155
+ { name: "Minutes", value: "Minutes" },
156
+ { name: "Hours", value: "Hours" },
157
+ { name: "Days", value: "Days" },
158
+ { name: "Weeks", value: "Weeks" }
159
+ )
160
+ )
161
+
162
+ .addStringOption((option) =>
163
+ option.setName("reason").setDescription("Why you want to do to that?")
164
+ )
165
+ )
166
+ .addSubcommand((scm) =>
167
+ scm
168
+ .setName("undeafen")
169
+ .setDescription("undeafen a member! (only use slash command)")
170
+
171
+ .addUserOption((option) =>
172
+ option
173
+ .setName("member")
174
+ .setDescription("Who do you want to call?")
175
+ .setRequired(true)
176
+ )
177
+ .addStringOption((option) =>
178
+ option.setName("reason").setDescription("Why you want to do to that?")
179
+ )
180
+ )
181
+ .addSubcommand((scm) =>
182
+ scm
183
+ .setName("unmute")
184
+ .setDescription("unmute a member! (only use slash command)")
185
+
186
+ .addUserOption((option) =>
187
+ option
188
+ .setName("member")
189
+ .setDescription("Who do you want to call?")
190
+ .setRequired(true)
191
+ )
192
+ .addStringOption((option) =>
193
+ option.setName("reason").setDescription("Why you want to do to that?")
194
+ )
195
+ )
196
+ .addSubcommand((scm) =>
197
+ scm
198
+ .setName("untimeout")
199
+ .setDescription("Untimeout a member! (only use slash command)")
200
+ .addUserOption((option) =>
201
+ option
202
+ .setName("member")
203
+ .setDescription("Who do you want to call?")
204
+ .setRequired(true)
205
+ )
206
+ .addStringOption((reason) =>
207
+ reason.setName("reason").setDescription("Why do you do that?")
208
+ )
209
+ )
210
+ .addSubcommand((scm) =>
211
+ scm
212
+ .setName("move")
213
+ .setDescription(
214
+ "Move member to another voice channel! (only use slash command)"
215
+ )
216
+ .addUserOption((option) =>
217
+ option
218
+ .setName("member")
219
+ .setDescription("Who do you want to call?")
220
+ .setRequired(true)
221
+ )
222
+ .addStringOption((channel) =>
223
+ channel
224
+ .setName("channel")
225
+ .setDescription("What voice chanel you want to move to")
226
+ )
227
+ .addStringOption((reason) =>
228
+ reason.setName("reason").setDescription("Why do you do that?")
229
+ )
230
+ ),
231
+
232
+ /**
233
+ *
234
+ * @param {discordClient} client
235
+ * @param {CommandInteraction} interaction
236
+ */
237
+ async execute(client, interaction) {
238
+ await interaction.deferReply({
239
+ ephemeral: true,
240
+ });
241
+
242
+ const scm = interaction.options.getSubcommand();
243
+
244
+ var result = "";
245
+
246
+ if (scm === "ban") {
247
+ const mb = interaction.options.getUser("member");
248
+ const reason = interaction.options.getString("reason");
249
+
250
+ const AuthorMember = interaction.guild.members.cache.find(
251
+ (member) => member.id === interaction.user.id
252
+ );
253
+ const targetMember = interaction.guild.members.cache.find(
254
+ (member) => member.id === mb.id
255
+ );
256
+
257
+ result = await ban_member(
258
+ client,
259
+ interaction,
260
+ AuthorMember,
261
+ targetMember,
262
+ reason
263
+ );
264
+ } else if (scm === "bans") {
265
+ await view_bans(client, interaction);
266
+ } else if (scm === "chnick") {
267
+ const mb = interaction.options.getUser("member");
268
+ const nick = interaction.options.getString("nick") ?? "";
269
+
270
+ var targetMember = interaction.guild.members.cache.find(
271
+ (member) => member.id === mb.id
272
+ );
273
+ var AuthorMember = interaction.guild.members.cache.find(
274
+ (member) => member.id === interaction.user.id
275
+ );
276
+
277
+ result = await chnick_member(
278
+ client,
279
+ interaction,
280
+ AuthorMember,
281
+ targetMember,
282
+ nick
283
+ );
284
+ } else if (scm === "chrole") {
285
+ const mb = interaction.options.getUser("member");
286
+ const rl = interaction.options.getRole("role");
287
+
288
+ var targetMember = interaction.guild.members.cache.find(
289
+ (member) => member.id === mb.id
290
+ );
291
+ var AuthorMember = interaction.guild.members.cache.find(
292
+ (member) => member.id === interaction.user.id
293
+ );
294
+ var rolee = interaction.guild.roles.cache.find(
295
+ (role) => role.name === rl.name
296
+ );
297
+
298
+ result = await chrole_member(
299
+ client,
300
+ interaction,
301
+ AuthorMember,
302
+ targetMember,
303
+ rolee
304
+ );
305
+ } else if (scm === "deafen") {
306
+ var mb = interaction.options.getUser("member");
307
+ var reason = interaction.options.getString("reason") ?? "None";
308
+
309
+ const AuthorMember = interaction.guild.members.cache.find(
310
+ (member) => member.id === interaction.user.id
311
+ );
312
+ const targetMember = interaction.guild.members.cache.find(
313
+ (member) => member.id === mb.id
314
+ );
315
+
316
+ result = await deafen_member(
317
+ client,
318
+ interaction,
319
+ AuthorMember,
320
+ targetMember,
321
+ reason
322
+ );
323
+ } else if (scm === "kick") {
324
+ const mb = interaction.options.getUser("member");
325
+ const reason = interaction.options.getString("reason") ?? "None";
326
+
327
+ var targetMember = interaction.guild.members.cache.find(
328
+ (member) => member.id === mb.id
329
+ );
330
+ var AuthorMember = interaction.guild.members.cache.find(
331
+ (member) => member.id === interaction.user.id
332
+ );
333
+
334
+ result = await kick_member(
335
+ client,
336
+ interaction,
337
+ AuthorMember,
338
+ targetMember,
339
+ reason
340
+ );
341
+ } else if (scm === "mute") {
342
+ var mb = interaction.options.getUser("member");
343
+ var reason = interaction.options.getString("reason") ?? "None";
344
+
345
+ const AuthorMember = interaction.guild.members.cache.find(
346
+ (member) => member.id === interaction.user.id
347
+ );
348
+ const targetMember = interaction.guild.members.cache.find(
349
+ (member) => member.id === mb.id
350
+ );
351
+
352
+ result = await mute_member(
353
+ client,
354
+ interaction,
355
+ AuthorMember,
356
+ targetMember,
357
+ reason
358
+ );
359
+ } else if (scm === "timeout") {
360
+ var mb = interaction.options.getUser("member");
361
+ var time = interaction.options.getInteger("time");
362
+ var value = interaction.options.getString("value");
363
+ var reason = interaction.options.getString("reason") ?? "None";
364
+
365
+ const AuthorMember = interaction.guild.members.cache.find(
366
+ (member) => member.id === interaction.user.id
367
+ );
368
+ const targetMember = interaction.guild.members.cache.find(
369
+ (member) => member.id === mb.id
370
+ );
371
+
372
+ result = await timeout_member(
373
+ client,
374
+ interaction,
375
+ AuthorMember,
376
+ targetMember,
377
+ time,
378
+ value,
379
+ reason
380
+ );
381
+ } else if (scm === "undeafen") {
382
+ var mb = interaction.options.getUser("member");
383
+ var reason = interaction.options.getString("reason") ?? "None";
384
+
385
+ const AuthorMember = interaction.guild.members.cache.find(
386
+ (member) => member.id === interaction.user.id
387
+ );
388
+ const targetMember = interaction.guild.members.cache.find(
389
+ (member) => member.id === mb.id
390
+ );
391
+
392
+ result = await undeafen_member(
393
+ client,
394
+ interaction,
395
+ AuthorMember,
396
+ targetMember,
397
+ reason
398
+ );
399
+ } else if (scm === "unmute") {
400
+ var mb = interaction.options.getUser("member");
401
+ var reason = interaction.options.getString("reason") ?? "None";
402
+
403
+ const AuthorMember = interaction.guild.members.cache.find(
404
+ (member) => member.id === interaction.user.id
405
+ );
406
+ const targetMember = interaction.guild.members.cache.find(
407
+ (member) => member.id === mb.id
408
+ );
409
+
410
+ result = await unmute_member(
411
+ client,
412
+ interaction,
413
+ AuthorMember,
414
+ targetMember,
415
+ reason
416
+ );
417
+ } else if (scm === "untimeout") {
418
+ const mb = interaction.options.getUser("member");
419
+ const reason = interaction.options.getString("reason") ?? "None";
420
+
421
+ const AuthorMember = interaction.guild.members.cache.find(
422
+ (member) => member.id === interaction.user.id
423
+ );
424
+ const targetMember = interaction.guild.members.cache.find(
425
+ (member) => member.id === mb.id
426
+ );
427
+
428
+ result = await untimeout_member(
429
+ client,
430
+ interaction,
431
+ AuthorMember,
432
+ targetMember,
433
+ reason
434
+ );
435
+ } else if (scm === "move") {
436
+ const mb = interaction.options.getUser("member");
437
+ const channel = interaction.options.getString("channel") ?? "None";
438
+ const reason = interaction.options.getString("reason") ?? "None";
439
+
440
+ const AuthorMember = interaction.guild.members.cache.find(
441
+ (member) => member.id === interaction.user.id
442
+ );
443
+ const targetMember = interaction.guild.members.cache.find(
444
+ (member) => member.id === mb.id
445
+ );
446
+
447
+ result = await move_member(
448
+ client,
449
+ interaction,
450
+ AuthorMember,
451
+ targetMember,
452
+ channel,
453
+ reason
454
+ );
455
+ }
456
+
457
+ if (result !== "") {
458
+ await interaction.followUp({
459
+ embeds: result,
460
+ ephemeral: true,
461
+ });
462
+ }
463
+ },
464
+ };
@@ -0,0 +1,166 @@
1
+ const {
2
+ SlashCommandBuilder,
3
+ CommandInteraction,
4
+ PermissionFlagsBits,
5
+ } = require("discord.js");
6
+ const {
7
+ discordClient,
8
+ join_voice,
9
+ leave_voice,
10
+ now_playing,
11
+ pausing,
12
+ play_music,
13
+ see_queue,
14
+ resuming,
15
+ set_loop,
16
+ shuffling,
17
+ skipping,
18
+ stopping,
19
+ } = require("../../src/index");
20
+
21
+ module.exports = {
22
+ data: new SlashCommandBuilder()
23
+ .setName("music")
24
+ .setDescription("Play and chill~")
25
+ .addSubcommand((scm) =>
26
+ scm.setName("join").setDescription("Join the your voice channel!")
27
+ )
28
+ .addSubcommand((scm) =>
29
+ scm.setName("leave").setDescription("Leave current voice channel!")
30
+ )
31
+ .addSubcommand((scm) =>
32
+ scm.setName("nplay").setDescription("Show current track")
33
+ )
34
+ .addSubcommand((scm) => scm.setName("pause").setDescription("Pause play!"))
35
+ .addSubcommand((scm) =>
36
+ scm
37
+ .setName("play")
38
+ .setDescription("Play music!")
39
+ .addStringOption((prompt) =>
40
+ prompt
41
+ .setName("prompt")
42
+ .setDescription("link or query (multi by using `,`)")
43
+ )
44
+ .addBooleanOption((isshuffle) =>
45
+ isshuffle
46
+ .setName("isshuffle")
47
+ .setDescription("Do you want to shuffle the queue?")
48
+ )
49
+ .addStringOption((isloop) =>
50
+ isloop
51
+ .setName("isloop")
52
+ .setDescription("Chose your loop mode")
53
+ .addChoices(
54
+ { name: "Track", value: "1" },
55
+ { name: "Queue", value: "2" },
56
+ { name: "Autoplay", value: "3" },
57
+ { name: "Disabled", value: "0" }
58
+ )
59
+ )
60
+ .addStringOption((mode) =>
61
+ mode
62
+ .setName("mode")
63
+ .setDescription("set your search mode(only use for search query)")
64
+ .addChoices(
65
+ { name: "Youtube", value: "youtube" },
66
+ { name: "Spotify", value: "spotify" },
67
+ { name: "Soundcloud", value: "soundcloud" }
68
+ )
69
+ )
70
+ )
71
+ .addSubcommand((scm) =>
72
+ scm
73
+ .setName("queue")
74
+ .setDescription("See the queue or make change tracks!")
75
+ )
76
+ .addSubcommand((scm) =>
77
+ scm.setName("resume").setDescription("Resume play!")
78
+ )
79
+ .addSubcommand((scm) =>
80
+ scm
81
+ .setName("setloop")
82
+ .setDescription("set repeat for your queue")
83
+ .addStringOption((mode) =>
84
+ mode
85
+ .setName("mode")
86
+ .setDescription("Chose your loop mode")
87
+ .setRequired(true)
88
+ .addChoices(
89
+ { name: "Track", value: "1" },
90
+ { name: "Queue", value: "2" },
91
+ { name: "Autoplay", value: "3" },
92
+ { name: "Disabled", value: "0" }
93
+ )
94
+ )
95
+ )
96
+ .addSubcommand((scm) =>
97
+ scm.setName("shuffle").setDescription("Shuffle the track!")
98
+ )
99
+ .addSubcommand((scm) =>
100
+ scm.setName("skip").setDescription("Play the next track!")
101
+ )
102
+ .addSubcommand((scm) =>
103
+ scm.setName("stop").setDescription("Stop play and leave!")
104
+ ),
105
+
106
+ /**
107
+ *
108
+ * @param {discordClient} client
109
+ * @param {CommandInteraction} interaction
110
+ */
111
+ async execute(client, interaction) {
112
+ await interaction.deferReply({
113
+ ephemeral: true,
114
+ });
115
+
116
+ const scm = interaction.options.getSubcommand();
117
+
118
+ var result = "";
119
+
120
+ if (scm === "join") {
121
+ result = await join_voice(client, interaction);
122
+ } else if (scm === "leave") {
123
+ result = await leave_voice(client, interaction);
124
+ } else if (scm === "nplay") {
125
+ result = await now_playing(client, interaction);
126
+ } else if (scm === "pause") {
127
+ result = await pausing(client, interaction);
128
+ } else if (scm === "play") {
129
+ var prompts = interaction.options.getString("prompt") ?? undefined;
130
+ const isloop = interaction.options.getString("isloop") ?? "None";
131
+ const shuffle = interaction.options.getBoolean("isshuffle");
132
+ const mode = interaction.options.getString("mode") ?? "None";
133
+
134
+ await play_music(
135
+ client,
136
+ interaction,
137
+ prompts,
138
+ isloop,
139
+ shuffle,
140
+ mode
141
+ ).then((data) => {
142
+ result = data;
143
+ });
144
+ } else if (scm === "queue") {
145
+ await see_queue(client, interaction);
146
+ } else if (scm === "resume") {
147
+ result = await resuming(client, interaction);
148
+ } else if (scm === "setloop") {
149
+ const mode = interaction.options.getString("mode");
150
+ result = await set_loop(client, interaction, mode);
151
+ } else if (scm === "shuffle") {
152
+ result = await shuffling(client, interaction);
153
+ } else if (scm === "skip") {
154
+ result = await skipping(client, interaction);
155
+ } else if (scm === "stop") {
156
+ result = await stopping(client, interaction);
157
+ }
158
+
159
+ if (result !== "") {
160
+ await interaction.followUp({
161
+ embeds: result,
162
+ ephemeral: true,
163
+ });
164
+ }
165
+ },
166
+ };