-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFollowCommand.js
194 lines (168 loc) · 6.31 KB
/
FollowCommand.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
const BaseCommand = require('../../utils/structures/BaseCommand');
const fetch = require('node-fetch');
const Discord = require('discord.js');
var fs = require('fs');
var readline = require('readline');fb
var cntr = 0;
const talkedRecently = new Set();
let cooldown;
let max;
module.exports = class FollowCommand extends BaseCommand {
constructor() {
super(s!follow', 'twitch', []);
}
async run(client, message, args, member) {
if (talkedRecently.has(message.author.id)) {
message.channel.send(
'You are currently on cooldown please wait... - ' +
messsage.author.username
);
} else {
if (isNaN(args[1])) {
return message.channel.send({embed: {
color: 8913151,
description: "The correctly command is: **s!follow** (**channel**) (**amount**)"
}});
}
if (message.member.roles.cache.has('830434469810143232')) {
if (args[1] > 2500) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``2500`` followers with the **Metal** plan"
}});
}};
// if (message.member.roles.cache.has('830434469810143232')) {
// if (args[1] > 12500) {
// return message.channel.send({embed: {
// color: 16776960,
// description: "You can not use more than ``12500`` followers with the **Admin** plan"
tge // }});
// }};
if (message.member.roles.cache.has('830434513922424852')) {
if (args[1] > 5000) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``5000`` followers with the **Gold** plan"
}});
}};
if (message.member.roles.cache.has('828799452654338099')) {
if (args[1] > 1500) {
return message.channel.send({embed: {
color: 16776960,
description: "You can not use more than ``1500`` followers with the **Metal** plan"
}});
}};
if (message.member.roles.cache.has('829101675893227580')) {
if (args[1] > 650) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``650`` followers with the **Bronze** plan"
}});
}};
if (message.member.roles.cache.has('828290829272612885')) {
if (args[1] > 2500) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``2500`` followers with the **VIP** plan"
}});
}};
if (message.member.roles.cache.has('829369472660930580')) {
if (args[1] > 1500) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``1500`` followers with the **Gold access** plan"
}});
}};
if (message.member.roles.cache.has('800884436693811230')) {
if (args[1] > 400) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``400`` followers with the **normal** plan"
}});
}};
if (message.member.roles.cache.has('829269672079654933')) {
if (args[1] > 5000) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``5000`` followers with the **Booster** plan"
}});
}};
if (message.member.roles.cache.has('829370249911599125')) {
if (args[1] > 650) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``650`` followers with the **Silver access** plan"
}});
}};
if (message.member.roles.cache.has('829369909737291827 ')) {
if (args[1] > 100) {
return message.channel.send({embed: {
color: 8913151,
description: "You can not use more than ``100`` followers with the **Bronze access** role"
}});
}};
let id = await fetch(
`https://api.twitch.tv/helix/users?login=${args[0].toString()}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer awrxthdsaol34wuqzyvwf3c2r3hghg',
'Client-id': 'kimne78kx3ncx6brgo4mv6wki5h1ko'
}
}
);
let json = await id.json();
let sending = new Discord.MessageEmbed()
.setAuthor(
`Adding ${args[1]} Twitch followers!`,
json.data[0].profile_image_url,
`https://www.twitch.tv/${json.data[0].display_name}`
).setColor('#8800FF')
.addField('Channel name', json.data[0].display_name)
.addField('Channel ID', json.data[0].id)
.setFooter(`You may run this command again in 5 minutes.`);
message.channel.send(sending);
console.log(
`Adding ${args[1]} follows to ${
json.data[0].display_name
} || Executed by: ${message.author.username}`
);
var rl = readline.createInterface({
input: fs.createReadStream('./all.txt')
});
rl.on('line', function(line) {
if (cntr++ < args[1]) {
fetch('https://gql.twitch.tv/gql', {
headers: {
accept: '*/*',
'accept-language': 'en-US',
authorization: `OAuth ${line}`,
'client-id': 'kimne78kx3ncx6brgo4mv6wki5h1ko',
'content-type': 'text/plain;charset=UTF-8',
'sec-ch-ua':
'"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'x-device-id': 'fkWkLSFgnouOunvs9uZvuJa0xrtCxKom'
},
referrer: 'https://www.twitch.tv/',
referrerPolicy: 'strict-origin-when-cross-origin',
body: `[{\"operationName\":\"FollowButton_FollowUser\",\"variables\":{\"input\":{\"disableNotifications\":false,\"targetID\":\"${
json.data[0].id
}\"}},\"extensions\":{\"persistedQuery\":{\"version\":1,\"sha256Hash\":\"3efee1acda90efdff9fef6e6b4a29213be3ee490781c5b54469717b6131ffdfe\"}}}]`,
method: 'POST',
mode: 'cors'
}).catch(err => console.log(err));
}
});
cntr = 0;
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 1000);
}
}
};