discord-selfbot-utils
Version:
The discord selfbot utils for mini raids, written on pure JS with Axios
127 lines (110 loc) • 3.98 kB
JavaScript
// Author: dmitryundead#0613
const axios = require("axios");
module.exports = class dsuClass {
apiURIVariable = "https://discordapp.com/api/v8/"; // API URI
verifyMessage; // check verifyByMessage method
botSpace; // switches between Bot and SelfBot. botSpace = "Bot " or botSpace = "";
constructor(arrayTokens, params) {
// let instance = new DSU([tokens],{channelId: "numbers"});
this.tokensArray = arrayTokens;
this.paramsObj = params;
}
get tokensArray() {
return this._tokensArray;
}
set tokensArray(arrayOfTokens) {
if (!arrayOfTokens.length) {
return;
}
this._tokensArray = arrayOfTokens;
}
get paramsObj() {
return this._paramsObj;
}
set paramsObj(parametersObj) {
if (!parametersObj.channelId) {
return;
}
this._paramsObj = parametersObj;
}
errOrSuccessStrStyle(errOrSuccessStr, indexStr) {
return String(errOrSuccessStr + "\tIn token:\t" + indexStr);
}
consoleClearing(cl = "\x1Bc") {
let clearing = require("process").stdout.write(cl);
}
generateString(len = 1999) {
let text = "";
for(let i = 0; i < len; i++) {
text += String.fromCharCode(Math.floor(Math.random() * 2000));
}
text = text.replace(/\`/g, "").replace(/\r?\n/g, "");
return text;
}
// something like "HKmAxsV"
serverLogin(inviteCode) {
this.tokensArray.forEach((currentlyToken, index) => {
axios({
url: `${this.apiURIVariable}invites/${inviteCode}`,
method: 'post',
headers: {
Authorization: currentlyToken}})
.then(res => {
console.log(errOrSuccessStrStyle(res.status, index));
})
.catch(err => {
console.error(errOrSuccessStrStyle(err, index));
});
});
}
startSpam(timesOfAttacks) {
if (this.paramsObj === undefined) {
console.error("Channel id isn't defined in paramsObj!");
process.exit();
}
else {
for(let i = 0; i < timesOfAttacks; i++) {
this.tokensArray.forEach((currentlyToken, index) => {
axios({
url: `${this.apiURIVariable}channels/${this.paramsObj.channelId}/messages`,
method: "post",
headers: {
authorization: this.botSpace + currentlyToken,
"Content-Type": "application/json"},
data: JSON.stringify({content: this.generateString(1999)})
})
.then(res => console.log(this.errOrSuccessStrStyle(res.status, index)))
.catch(err =>
console.error(this.errOrSuccessStrStyle(err, index)));
});
}
}
}
verifyByReaction(channelId, messageId, emoteId) {
let emote_URI = encodeURIComponent(emoteId);
this.tokensArray.forEach((currentlyToken, index) => {
axios({
url: `${this.apiURIVariable}channels/${channelId}/messages/${messageId}/reactions/${emote_URI}/@me`,
method: "put",
headers: {
authorization: currentlyToken}
})
.then(res => console.log(this.errOrSuccessStrStyle(res.status, index)))
.catch(err => console.error(this.errOrSuccessStrStyle(err, index)));
});
}
verifyByMessage(channelId) {
this.tokensArray.forEach((currentlyToken, index) => {
axios({
url: `${this.apiURIVariable}channels/${channelId}/messages`,
method: "post",
headers: {
authorization: this.botSpace + currentlyToken,
"Content-Type": "application/json"},
data: JSON.stringify({content: this.verifyMessage})
})
.then(res => console.log(this.errOrSuccessStrStyle(res.status, index)))
.catch(err => console.log(this.errOrSuccessStrStyle(err, index)));
});
}
};