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
package/README.md CHANGED
@@ -1,5 +1,136 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=fetch-datas for more information.
1
+ # Discord bot template using javascript
2
+
3
+ # Install:
4
+
5
+ ```shell
6
+ npm i fetch-datas
7
+ ```
8
+
9
+ # Support:
10
+
11
+ 1. Moderator:
12
+ ```shell
13
+ - ban: | ban a member
14
+ - bans: | view baned list
15
+ - chnick: | change nick name a member
16
+ - chrole: | change role a member
17
+ - deafen: | set deafen a member
18
+ - kick: | kick a member
19
+ - mute: | set mute a member
20
+ - move | move member to another voice channel
21
+ - timeout: | set timeout a member
22
+ - undeafen: | remove deafen a member
23
+ - unmute: | remove mute a member
24
+ - untimeout: | remove timeout a member
25
+ ```
26
+
27
+ 2. Music:
28
+ ```shell
29
+ - join: | join your current voice channel
30
+ - leave: | leave current voice channel
31
+ - nplay: | see what track is playing
32
+ - pause: | Pause playing
33
+ - play: | play an url, find and play from a query
34
+ - queue: | see current queue
35
+ - resume: | resume playing
36
+ - setloop: | set repeated mode for your queue
37
+ - shuffle: | shuffle current queue
38
+ - skip: | skip current track to next track
39
+ - stop: | stop playing and leave voice channel
40
+ ```
41
+
42
+ 3. Ultility:
43
+ ```shell
44
+ - ping: | get latency of your bot and API
45
+ - status: | get bot's status
46
+ - chat: | Ask Bing AI or Google Bard
47
+ ```
48
+
49
+ # Usage:
50
+
51
+ 1. Create `config.json`
52
+
53
+ ```json
54
+ {
55
+ "name": "", (You can use that for your help command)
56
+ "prefix": "Your-prefix", (Only use if you want to use prefix command)
57
+
58
+ "token": "Your-Bot-Token",
59
+ "clientId": "Your-Bot-ClientId",
60
+
61
+ "__Secure_1PSID": "Your-cookie-__Secure-1PSID",
62
+ "__Secure_1PSIDTS": "Your-cookie-__Secure-1PSIDTS",
63
+
64
+ "cookie_U": "Your-cookie-_U",
65
+
66
+ "YOUTUBE_API_KEY": "Your-Youtube-API-key"
67
+ }
68
+ ```
69
+
70
+ 2. Run
71
+
72
+ ```shell
73
+ node test/index.js
74
+ ```
75
+
76
+ # How to get token and clientID:
77
+
78
+ 1. Token
79
+
80
+ > Go to https://discord.com/developers/applications/
81
+ >
82
+ > Chose your discord bot
83
+ >
84
+ > Chose `Bot`
85
+ >
86
+ > Chose `Reset Token` and follow the directions, then copy `token`
87
+ >
88
+ > Go to `config.py`
89
+ >
90
+ > Paste your Token to variable named `token`
91
+
92
+ 2. CLientID
93
+
94
+ > Go to https://discord.com/developers/applications/
95
+ >
96
+ > Chose your discord bot
97
+ >
98
+ > Copy `application ID` value
99
+ >
100
+ > Go to `config.py`
101
+ >
102
+ > Paste your Token to variable named `clientID`
103
+
104
+ # How to get cookies for ai reponse:
105
+
106
+ 1. Bing AI
107
+
108
+ > Go to https://bing.com/chat
109
+ >
110
+ > Run your cookies extension
111
+ >
112
+ > Copy value of cookies named `_U`
113
+ >
114
+ > Go to `config.json`
115
+ >
116
+ > Paste the cookies to `cookie_U`
117
+
118
+ 2. Google Bard
119
+
120
+ > Go to https://bard.google.com/
121
+ >
122
+ > Run your `cookies extension`
123
+ >
124
+ > Copy values of cookies named `__Secure-1PSID` and `__Secure-1PSIDTS`
125
+ >
126
+ > Go to `config.json`
127
+ >
128
+ > Paste your cookies value to `__Secure_1PSID` and `__Secure_1PSIDTS`
129
+
130
+ # Get FFMPEG:
131
+
132
+ > Go to https://ffmpeg.org/download.html
133
+ >
134
+ > Download latest version for your OS system
135
+ >
136
+ > Make sure that ffmpeg can run in your terminal or cmd. If you use Windows, you should add to Your environment variables
package/index.js ADDED
@@ -0,0 +1,66 @@
1
+ const {
2
+ ban_member,
3
+ view_bans,
4
+ chnick_member,
5
+ chrole_member,
6
+ deafen_member,
7
+ kick_member,
8
+ mute_member,
9
+ timeout_member,
10
+ undeafen_member,
11
+ unmute_member,
12
+ untimeout_member,
13
+ move_member,
14
+ join_voice,
15
+ leave_voice,
16
+ now_playing,
17
+ pausing,
18
+ play_music,
19
+ see_queue,
20
+ resuming,
21
+ set_loop,
22
+ shuffling,
23
+ skipping,
24
+ stopping,
25
+ playing,
26
+ get_result,
27
+ get_ping,
28
+ get_status,
29
+ discordClient,
30
+ } = require("./src/index");
31
+
32
+ module.exports = {
33
+ // CLient
34
+ discordClient,
35
+ // Moderator
36
+ ban_member,
37
+ view_bans,
38
+ chnick_member,
39
+ chrole_member,
40
+ deafen_member,
41
+ kick_member,
42
+ mute_member,
43
+ timeout_member,
44
+ undeafen_member,
45
+ unmute_member,
46
+ untimeout_member,
47
+ move_member,
48
+ // Music
49
+ join_voice,
50
+ leave_voice,
51
+ now_playing,
52
+ pausing,
53
+ play_music,
54
+ see_queue,
55
+ resuming,
56
+ set_loop,
57
+ shuffling,
58
+ skipping,
59
+ stopping,
60
+ playing,
61
+ // Ai
62
+ get_result,
63
+ // Ultility
64
+ get_ping,
65
+ get_status,
66
+ };
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
- {
2
- "name": "fetch-datas",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
1
+ {
2
+ "name": "fetch-datas",
3
+ "version": "1.4.3",
4
+ "description": "discordbot commands using js",
5
+ "main": "./src/processor/Music/support/playing.js",
6
+ "scripts": {
7
+ "test": "test/index.js"
8
+ },
9
+ "keywords": [
10
+ "discord",
11
+ "bot"
12
+ ],
13
+ "author": "Semalmas",
14
+ "license": "MIT",
15
+ "bugs": {
16
+ "url": "https://github.com/semalmas/discord-fetcher/issues"
17
+ },
18
+ "homepage": "https://github.com/semalmas/discord-fetcher#readme",
19
+ "dependencies": {
20
+ "@discordjs/opus": "^0.9.0",
21
+ "@discordjs/voice": "^0.16.0",
22
+ "bingai-js": "^1.5.0",
23
+ "discord-player": "^6.6.4",
24
+ "discord.js": "^14.13.0",
25
+ "googlebard-js": "^1.1.5",
26
+ "lodash": "^4.17.21",
27
+ "youtube-ext": "^1.1.14"
28
+ }
29
+ }
package/src/client.js ADDED
@@ -0,0 +1,74 @@
1
+ const discord = require("discord.js");
2
+ const { Player } = require("discord-player");
3
+ const { ChatBot: EdgeChatBot } = require("bingai-js");
4
+ const { ChatBot: BardChatBot } = require("googlebard-js");
5
+ const {
6
+ SpotifyExtractor,
7
+ YouTubeExtractor,
8
+ SoundCloudExtractor,
9
+ } = require("@discord-player/extractor");
10
+
11
+ class discordClient {
12
+ constructor(data) {
13
+ /**
14
+ * data = {
15
+ * name: str,
16
+ * prifix: str,
17
+ * youtube_api_key: str,
18
+ * __Secure_1PSID,
19
+ * __Secure_1PSIDTS,
20
+ * cookie_U : str,
21
+ * version: str,
22
+ * }
23
+ */
24
+ this.name = data.name;
25
+ this.version = data.version;
26
+ this.ytb_api_key = data.youtube_api_key;
27
+ this.prefix = data.prefix;
28
+ this.client = new discord.Client({
29
+ intents: Object.keys(discord.GatewayIntentBits).map((a) => {
30
+ return discord.GatewayIntentBits[a];
31
+ }),
32
+ });
33
+
34
+ this.player = new Player(this.client, {
35
+ ytdlOptions: {
36
+ quality: "highestaudio",
37
+ },
38
+ });
39
+
40
+ this.ctrack = {};
41
+ this.ptrack = {};
42
+
43
+ this.isloop = {};
44
+
45
+ // You can add more colors here
46
+ this.color = [
47
+ 0xcd5c5c, 0xff6a6a, 0xee6363, 0xcd5555, 0x8b3a3a, 0xb22222, 0xff3030,
48
+ 0xee2c2c, 0xcd2626, 0x8b1a1a, 0xa52a2a, 0xff4040, 0xee3b3b, 0x8b2323,
49
+ 0xff8c00, 0xff7f00, 0xee7600, 0xcd6600, 0xff6347, 0xee5c42, 0xff4500,
50
+ 0xee4000, 0xff0000, 0xee0000, 0xdc143c, 0xcd3333,
51
+ ];
52
+
53
+ const cookie = `__Secure-1PSIDTS=${data.__Secure_1PSIDTS};__Secure-1PSID=${data.__Secure_1PSID}`;
54
+
55
+ this.BardChatBot = new BardChatBot(cookie);
56
+ this.EdgeChatBot = new EdgeChatBot(data.cookie_U);
57
+ }
58
+
59
+ get_color() {
60
+ var rand = Math.floor(Math.random() * this.color.length);
61
+
62
+ return this.color[rand];
63
+ }
64
+
65
+ async setup() {
66
+ await this.player.extractors.loadDefault();
67
+ await this.player.extractors.register(SpotifyExtractor, {});
68
+ await this.player.extractors.register(SoundCloudExtractor, {});
69
+ await this.player.extractors.register(YouTubeExtractor, {});
70
+ await this.BardChatBot.getAPI();
71
+ }
72
+ }
73
+
74
+ module.exports = discordClient;
package/src/index.js ADDED
@@ -0,0 +1,69 @@
1
+ const {
2
+ ban_member,
3
+ view_bans,
4
+ chnick_member,
5
+ chrole_member,
6
+ deafen_member,
7
+ kick_member,
8
+ mute_member,
9
+ timeout_member,
10
+ undeafen_member,
11
+ unmute_member,
12
+ untimeout_member,
13
+ move_member,
14
+ } = require("./processor/Moderator");
15
+
16
+ const {
17
+ join_voice,
18
+ leave_voice,
19
+ now_playing,
20
+ pausing,
21
+ play_music,
22
+ see_queue,
23
+ resuming,
24
+ set_loop,
25
+ shuffling,
26
+ skipping,
27
+ stopping,
28
+ playing,
29
+ } = require("./processor/Music");
30
+
31
+ const { get_ping, get_status, get_result } = require("./processor/Ultility");
32
+
33
+ const discordClient = require("./client");
34
+
35
+ module.exports = {
36
+ // Client
37
+ discordClient,
38
+ // Moderator
39
+ ban_member,
40
+ view_bans,
41
+ chnick_member,
42
+ chrole_member,
43
+ deafen_member,
44
+ kick_member,
45
+ mute_member,
46
+ timeout_member,
47
+ undeafen_member,
48
+ unmute_member,
49
+ untimeout_member,
50
+ move_member,
51
+ // Music
52
+ join_voice,
53
+ leave_voice,
54
+ now_playing,
55
+ pausing,
56
+ play_music,
57
+ see_queue,
58
+ resuming,
59
+ set_loop,
60
+ shuffling,
61
+ skipping,
62
+ stopping,
63
+ playing,
64
+ // Ai
65
+ get_result,
66
+ // Ultility
67
+ get_ping,
68
+ get_status,
69
+ };
@@ -0,0 +1,54 @@
1
+ const { CommandInteraction, EmbedBuilder } = require('discord.js');
2
+
3
+ module.exports = ban_member
4
+
5
+ /**
6
+ *
7
+ * @param {CommandInteraction} interaction
8
+ */
9
+
10
+ async function ban_member(client, interaction, user, target, reason) {
11
+
12
+ const AuthorMember = interaction.guild.members.cache.find(member => member.id === user.id);
13
+ const targetMember = interaction.guild.members.cache.find(member => member.id === target.id);
14
+
15
+ try {
16
+ if (AuthorMember.roles.highest.position > targetMember.roles.highest.position) {
17
+
18
+ await targetMember.ban({ reason: reason });
19
+
20
+ return [
21
+ new EmbedBuilder()
22
+ .setColor(client.get_color())
23
+ .addFields({
24
+ name: `Yes, you have banned ${AuthorMember.nickname}`,
25
+ value: `Reason: ${reason}`
26
+ })
27
+ ]
28
+ }
29
+ else {
30
+ return [
31
+ new EmbedBuilder()
32
+ .setColor(client.get_color())
33
+ .addFields({
34
+ name: `You can't do this action`,
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
+ }
52
+
53
+
54
+