New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord-user-bots

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-user-bots - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

examples/eventlisteners.js

@@ -30,2 +30,2 @@ const Discord = require("discord-user-bots");

client.on.guild_leave = function (guild) { }; // Will be used when a guild is removed from your user
client.on.guild_leave = function (guild) { }; // Will be used when a guild is removed from your user

@@ -51,3 +51,3 @@ const Discord = require("discord-user-bots");

this.user_settings = {
timezone_offset: timezone-offset-goes-here, // (int)
timezone_offset: timezone_offset_goes_here, // (int)
theme: 'dark',

@@ -213,2 +213,2 @@ stream_notifications_enabled: true,

this.analytics_token = 'token-goes-here';
this._trace = ["stringified-json"];
this._trace = ["stringified-json"];
{
"name": "discord-user-bots",
"version": "1.1.0",
"version": "1.2.0",
"description": "I library that allows you tuse the full potential of Discords api to create good user bots.",

@@ -9,3 +9,3 @@ "main": "src/exports.js",

},
"keywords": [],
"keywords": ["discord", "userbots", "selfbots", "bots", "discord.js", "discord user bots"],
"author": "Sopur",

@@ -12,0 +12,0 @@ "license": "GNU",

@@ -198,2 +198,7 @@ const fetch = require("node-fetch");

/**
* Fetches all the info about the guild given
* @param {string} guildid The guild ID to fetch
* @returns {object} The guild info
*/
async getguild(guildid) {

@@ -226,2 +231,8 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Joins a server or group chat
* @param {string} invite The Discord invite
* @param {boolean} trim If this is set to true, the invite will be stripped of the "https://discord.gg/" automatically, otherwise it will just send the invite param given
* @returns {Object} The response from Discord
*/
async join_guild(invite, trim = false) {

@@ -254,2 +265,7 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Leaves a server
* @param {string} guildid The guild ID to leave from
* @returns {Object} The response from Discord
*/
async leave_guild(guildid) {

@@ -279,2 +295,8 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Sends a message with the channel given
* @param {string} message The message you want to send
* @param {string} channelid The channel you want to send it in
* @returns {object} The message info
*/
async send(message, channelid) {

@@ -311,2 +333,9 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Replies to a message
* @param {string} message The message content
* @param {string} targetmessageid The message to reply
* @param {string} channelid The channel ID of the message
* @returns {object} The message info
*/
async reply(message, targetmessageid, channelid) {

@@ -355,2 +384,8 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Deletes a message
* @param {string} targetmessageid The message to delete
* @param {string} channelid The channel the message is in
* @returns {object} The response from Discord
*/
async delete_message(targetmessageid, channelid) {

@@ -381,5 +416,27 @@ if (this.ready_status === 0) return new Error("Client still in connecting state.");

/**
* Types in the channel given
* @param {string} channelid The channel ID to type in
*/
async type(channelid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!channelid) return new Error("Invalid parameters");
fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/typing`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin"
},
"referrer": `https://discord.com/channels/@me/${channelid}`,
"referrerPolicy": "no-referrer-when-downgrade",
"body": null,
"method": "POST",
"mode": "cors"
});
this.typingLoop = setInterval(() => {

@@ -402,3 +459,2 @@ fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/typing`, {

}, this.config.typinginterval);
return true;
};

@@ -412,4 +468,171 @@

/**
* Creates a group with the people you want
* @param {Array} recipients The people to be in the group when it's made
* @returns {object} The group info
*/
async create_group(recipients) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (recipients === undefined) return new Error("Invalid parameters");
if (recipients.length < 2) return new Error("Must include at least 3 people/user IDS.");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/users/@me/channels`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
"referrer": "https://discord.com/channels/@me/",
"referrerPolicy": "no-referrer-when-downgrade",
"body": JSON.stringify({
"recipients": recipients,
}),
"method": "POST",
"mode": "cors",
}).then((response) => {
response.json().then(m => {
res(m);
});
});
});
};
/**
* Leaves a group
* @param {string} groupid The group ID to leave
* @returns {object} The response from Discord
*/
async leave_group(groupid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (groupid === undefined) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/channels/${groupid}`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
"referrer": "https://discord.com/channels/@me",
"referrerPolicy": "no-referrer-when-downgrade",
"body": null,
"method": "DELETE",
"mode": "cors",
}).then((response) => {
response.json().then(m => {
res(m);
});
});
});
};
/**
* Removes someone from a group
* @param {string} personid Person ID to be removed
* @param {string} channelid Group ID to have someone removed from
* @returns {object} The response from Discord
*/
async remove_person_from_group(personid, channelid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!channelid || !personid) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/recipients/${personid}`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
"referrer": "https://discord.com/channels/@me",
"referrerPolicy": "no-referrer-when-downgrade",
"body": null,
"method": "DELETE",
"mode": "cors"
}).then((response) => {
res(response);
});
});
};
/**
* Renames a group
* @param {string} name The name
* @param {string} channelid The group ID to be renamed
* @returns {object} The response from Discord
*/
async rename_group(name, groupid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!groupid || !name) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/channels/${groupid}`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
"referrer": "https://discord.com/channels/@me",
"referrerPolicy": "no-referrer-when-downgrade",
"body": JSON.stringify({
"name": name
}),
"method": "PATCH",
"mode": "cors"
}).then((response) => {
res(response);
});
});
};
/**
* Creates a server
* @param {string} name Name of the server
* @param {string} guild_template_code The template of the server, it's set to the defualt server template when not set by you
* @returns {object} The server info
*/
async create_server(name, guild_template_code = "2TffvPucqHkN") {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!name) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/guilds`, {
"headers": {
"accept": "*/*",
"accept-language": this.config.language,
"authorization": this.token,
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
},
"referrer": "https://discord.com/channels/@me",
"referrerPolicy": "no-referrer-when-downgrade",
"body": JSON.stringify({
"name": name,
"icon": null,
"channels": [],
"system_channel_id": null,
"guild_template_code": guild_template_code,
}),
"method": "POST",
"mode": "cors"
}).then((response) => {
response.json().then(m => {
res(m);
});
});
});
};
};
module.exports = Client;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc