discord-user-bots
Advanced tools
Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "discord-user-bots", | ||
"version": "1.2.2", | ||
"description": "I library that allows you tuse the full potential of Discords api to create good user bots.", | ||
"version": "1.2.3", | ||
"description": "I library that allows you to use the full potential of Discords api to create good user bots.", | ||
"main": "src/exports.js", | ||
@@ -21,5 +21,13 @@ "scripts": { | ||
"homepage": "https://github.com/Someguy1834/Discord-user-bots", | ||
"keywords": ["discord", "userbots", "selfbots", "bots", "discord.js", "discord user bots", "api"], | ||
"keywords": [ | ||
"discord", | ||
"userbots", | ||
"selfbots", | ||
"bots", | ||
"discord.js", | ||
"discord user bots", | ||
"api" | ||
], | ||
"author": "Sopur", | ||
"license": "GNU" | ||
} | ||
} |
549
README.md
# Sopur's user bot library | ||
Hello! This is a user bot library the allows | ||
@@ -6,3 +7,3 @@ for a lot more things than Discord.js. | ||
to everything a legit client does: | ||
like user notes, friend counts, | ||
like user notes, friend counts, | ||
the defualt Discord tutorial, | ||
@@ -17,2 +18,3 @@ and everything else. | ||
Here's a small example of this library: | ||
```js | ||
@@ -22,7 +24,7 @@ const Discord = require("discord-user-bots"); | ||
client.on.ready = function() { | ||
client.on.ready = function () { | ||
console.log("Client online!"); | ||
}; | ||
client.on.message_create = function(message) { | ||
client.on.message_create = function (message) { | ||
console.log(message); | ||
@@ -33,4 +35,4 @@ }; | ||
# Functions | ||
```js | ||
// The channel ID | ||
@@ -42,3 +44,2 @@ // v | ||
// The guild ID | ||
@@ -48,3 +49,2 @@ // v | ||
// The server invite | ||
@@ -56,3 +56,2 @@ // v | ||
// The guild ID | ||
@@ -62,3 +61,2 @@ // v | ||
// The channel ID | ||
@@ -70,3 +68,2 @@ // v | ||
// Target message ID The channel ID | ||
@@ -78,3 +75,2 @@ // v v | ||
// The channel ID | ||
@@ -86,3 +82,2 @@ // v | ||
// The channel ID | ||
@@ -93,3 +88,2 @@ // v | ||
client.create_group(["person-id", "you can have up to 10", "(Including you)"]); | ||
@@ -99,3 +93,2 @@ // ^ | ||
client.leave_group("785986028955500596"); | ||
@@ -105,3 +98,2 @@ // ^ | ||
// Person ID to be removed | ||
@@ -113,3 +105,2 @@ // v | ||
// The name | ||
@@ -121,3 +112,2 @@ // v | ||
// Name of the server | ||
@@ -129,8 +119,8 @@ // v | ||
// server template when not set by you | ||
``` | ||
``` | ||
**Keep in mind that all of these functions return Promises when they are finished with all the information about the action you just made execpt for type, stopType, delete_message, and leave_guild.** | ||
# Event listeners | ||
```js | ||
@@ -169,2 +159,3 @@ | ||
# Properties | ||
My library focuses on allowing you to access | ||
@@ -175,7 +166,7 @@ absolutely everthing a normal Discord client can. | ||
**Here are some of them:** | ||
```js | ||
this.user_settings = user.user_settings; // An object full of properties of settings | ||
this.user = user.user // An object full of properties about the user like username etc | ||
this.user = user.user; // An object full of properties about the user like username etc | ||
@@ -188,3 +179,3 @@ this.tutorial = user.tutorial; // A property | ||
this.guild_join_requests = user.guild_join_requests // An array | ||
this.guild_join_requests = user.guild_join_requests; // An array | ||
@@ -220,13 +211,12 @@ this.user_guild_settings = user.user_guild_settings; // An array of Objects | ||
this._trace = user._trace; // Stringified json | ||
``` | ||
# Now here are those properties in a more readable form: | ||
```js | ||
this.user_settings = { | ||
timezone_offset: timezone-offset-goes-here, // (int) | ||
theme: 'dark', | ||
timezone_offset: timezone - offset - goes - here, // (int) | ||
theme: "dark", | ||
stream_notifications_enabled: true, | ||
status: 'invisible', | ||
status: "invisible", | ||
show_current_game: true, | ||
@@ -238,3 +228,3 @@ restricted_guilds: [], | ||
message_display_compact: false, | ||
locale: 'locale-goes-here', | ||
locale: "locale-goes-here", | ||
inline_embed_media: true, | ||
@@ -258,17 +248,32 @@ inline_attachment_media: true, | ||
allow_accessibility_detection: false, | ||
afk_timeout: 600 | ||
afk_timeout: 600, | ||
}; | ||
this.user_guild_settings = [ | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object], [Object], | ||
[Object], [Object] | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
]; | ||
this.user = { | ||
verified: true, | ||
username: 'Sopur', | ||
username: "Sopur", | ||
premium: false, | ||
@@ -279,126 +284,398 @@ phone: null, | ||
mfa_enabled: false, | ||
id: 'id-goes-here', | ||
id: "id-goes-here", | ||
flags: 0, | ||
email: 'email-goes-here', | ||
discriminator: 'discriminator-goes-here', | ||
email: "email-goes-here", | ||
discriminator: "discriminator-goes-here", | ||
desktop: true, | ||
avatar: 'avatar-goes-here', | ||
avatar: "avatar-goes-here", | ||
}; | ||
this.tutorial = null; | ||
this.session_id = 'session_id-goes-here'; | ||
this.session_id = "session_id-goes-here"; | ||
this.relationships = [ | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object] | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
]; | ||
this.read_state = [ | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
]; | ||
this.private_channels = [ | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
]; | ||
this.presences = [ | ||
[Object], [Object], | ||
[Object], [Object], | ||
[Object], [Object], | ||
[Object], [Object], | ||
[Object] | ||
]; | ||
this.presences = [[Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object]]; | ||
this.notes = { | ||
'id-goes-here': 'note-goes-here', | ||
"id-goes-here": "note-goes-here", | ||
}; | ||
this.guilds = [ | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object], [Object], [Object], | ||
[Object], [Object] | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
[Object], | ||
]; | ||
this.guild_join_requests = []; | ||
this.guild_experiments = [ | ||
[Array], [Array], [Array], | ||
[Array], [Array], [Array], | ||
[Array], [Array], [Array], | ||
[Array], [Array], [Array], | ||
[Array], [Array], [Array], | ||
[Array], [Array] | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
]; | ||
this.geo_ordered_rtc_regions = ['geo', 'ordered', 'rtc', 'regions', 'go', 'here']; | ||
this.geo_ordered_rtc_regions = ["geo", "ordered", "rtc", "regions", "go", "here"]; | ||
this.friend_suggestion_count = 0; | ||
this.experiments = [ | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array], [Array], [Array], [Array], [Array], | ||
[Array] | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
[Array], | ||
]; | ||
this.country_code = 'country-goes-here'; | ||
this.country_code = "country-goes-here"; | ||
this.consents = { personalization: [Object] }; | ||
this.connected_accounts = [[Object]]; | ||
this.analytics_token = 'token-goes-here'; | ||
this.analytics_token = "token-goes-here"; | ||
this._trace = ["stringified-json"]; | ||
``` | ||
# What's new | ||
Added 5 new functions: | ||
- create_group | ||
- leave_group | ||
- remove_person_from_group | ||
- rename_group | ||
- create_server | ||
Documention for these functions are shown above, | ||
and in the source. | ||
The soft-ban on self bots that disallows self bots to not see contents of messages has been evaded. | ||
You can now see message contents and bypass this soft-ban. |
@@ -8,4 +8,4 @@ const fetch = require("node-fetch"); | ||
this.config = { | ||
api: "v8", | ||
wsurl: "wss://gateway.discord.gg/?v=6&encoding=json", | ||
api: "v9", | ||
wsurl: "wss://gateway.discord.gg/?encoding=json&v=9", | ||
os: "linux", | ||
@@ -17,4 +17,2 @@ bd: "holy", | ||
this.token = token; | ||
const ws = new WebSocket(this.config.wsurl); | ||
this.ws = ws; | ||
this.lastheartbeat = undefined; | ||
@@ -69,9 +67,13 @@ this.ready_status = 0; | ||
this.checkToken().then((res) => { | ||
if (res === true) this.setEvents() | ||
else throw new Error(`Token "${token}" is invalid`); | ||
}); | ||
} | ||
setEvents() { | ||
const ws = new WebSocket(this.config.wsurl); | ||
this.ws = ws; | ||
ws.on("message", (message) => { | ||
message = JSON.parse(message); | ||
setTimeout(() => { | ||
if (this.ready_status === 0) { | ||
console.log("Discord is taking a while to respond. Maybe incorrect token?"); | ||
}; | ||
}, 5000); | ||
switch (message.t) { | ||
@@ -85,3 +87,3 @@ case null: { // gateway | ||
}, this.heartbeattimer); | ||
ws.send(JSON.stringify(new Packet.GateWayOpen(token, this.config))); | ||
ws.send(JSON.stringify(new Packet.GateWayOpen(this.token, this.config))); | ||
this.on.gateway(); | ||
@@ -174,3 +176,16 @@ } else { | ||
checkToken() { | ||
return new Promise((resolve) => { | ||
fetch( | ||
`https://discord.com/api/${this.config.api}/users/@me`, | ||
new Packet.tokenCheck(this.token) | ||
).then((r) => { | ||
r.json().then((res) => { | ||
resolve(res.message !== "401: Unauthorized"); | ||
}); | ||
}); | ||
}); | ||
} | ||
async fetchmessages(limit, channelid) { | ||
@@ -177,0 +192,0 @@ if (this.ready_status === 0) return new Error("Client still in connecting state."); |
@@ -7,24 +7,34 @@ class GateWayOpen { | ||
"token": token, | ||
"intents": 513, | ||
"capabilities": 125, | ||
"properties": { | ||
"$os": config.os, | ||
"$browser": config.bd, | ||
"$device": config.bd | ||
"os": config.os, | ||
"browser": config.bd, | ||
"device": "", | ||
"system_locale": config.language, | ||
"browser_user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36", | ||
"browser_version": "91.0.4472.106", | ||
"os_version": "", | ||
"referrer": "", | ||
"referring_domain": "", | ||
"referrer_current": "", | ||
"referring_domain_current": "", | ||
"release_channel": "stable", | ||
"client_build_number": 92214, | ||
"client_event_source": null | ||
}, | ||
"presence": { | ||
"status": "online", | ||
"since": 0, | ||
"activities": [], | ||
"afk": false | ||
}, | ||
"compress": false, | ||
"large_threshold": 250, | ||
"guild_subscriptions": false, | ||
}, | ||
"shard": [0, 1], | ||
"presence": { | ||
"activities": [{ | ||
"name": "", | ||
"type": 0 | ||
}], | ||
"status": "online", | ||
"since": 91879201, | ||
"afk": false | ||
}, | ||
"intents": 7 | ||
}; | ||
"client_state": { | ||
"guild_hashes": {}, | ||
"highest_last_message_id": "0", | ||
"read_state_version": 0, | ||
"user_guild_settings_version": -1 | ||
} | ||
} | ||
} | ||
}; | ||
@@ -55,2 +65,24 @@ }; | ||
module.exports = { GateWayOpen, HeartBeat, GuildRequest }; | ||
class tokenCheck { | ||
constructor(token) { | ||
return { | ||
"headers": { | ||
"accept": "*/*", | ||
"accept-language": "en-US", | ||
"authorization": token, | ||
"sec-ch-ua": "\" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\"", | ||
"sec-ch-ua-mobile": "?0", | ||
"sec-fetch-dest": "empty", | ||
"sec-fetch-mode": "cors", | ||
"sec-fetch-site": "same-origin" | ||
}, | ||
"referrer": "https://discord.com/login?redirect_to=%2Fchannels%2F%40me", | ||
"referrerPolicy": "strict-origin-when-cross-origin", | ||
"body": null, | ||
"method": "GET", | ||
"mode": "cors" | ||
}; | ||
} | ||
} | ||
module.exports = { GateWayOpen, HeartBeat, GuildRequest, tokenCheck }; |
60578
11
979
658
15