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.0.0 to 1.1.0

4

examples/eventlisteners.js

@@ -27,1 +27,5 @@ const Discord = require("discord-user-bots");

client.on.channel_update = function (channel) { }; // Will be used when a channel is updated
client.on.guild_join = function (guild) { }; // Will be used when a guild is added to your user
client.on.guild_leave = function (guild) { }; // Will be used when a guild is removed from your user

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

// The channel ID

@@ -13,2 +14,19 @@ // v

// The guild ID
// v
client.getguild("794326789480120374");
// The server invite
// v
client.join_guild("invite-code", false);
// ^
// Make this second parameter true if you want to use a http link, it's false by defualt
// The guild ID
// v
client.leave_guild("794326789480120374");
// The channel ID

@@ -28,5 +46,12 @@ // v

// The channel ID
// v
client.delete_message("794339629553156116", "794329000897806387");
// ^
// Target message ID
// The channel ID
// v
client.type("794326789480120374");
cleint.stopType();
cleint.stopType();

2

package.json
{
"name": "discord-user-bots",
"version": "1.0.0",
"version": "1.1.0",
"description": "I library that allows you tuse the full potential of Discords api to create good user bots.",

@@ -5,0 +5,0 @@ "main": "src/exports.js",

# Sopur's user bot library
Hello! This is a user bot library the allows for a lot more things than Discord.js.
For example, this library allows you to access to everything a legit client does. Like user notes, friend counts, the defualt Discord tutorial, and everything else.
For example, this library allows you to access to everything a legit client does;
like user notes, friend counts, the defualt Discord tutorial, and everything else.
This library is in a early state and needs more work.

@@ -33,2 +34,19 @@ More functions will be added soon.

// The guild ID
// v
client.getguild("794326789480120374");
// The server invite
// v
client.join_guild("invite-code", false);
// ^
// Make this second parameter true if you want to use a http link, it's false by defualt
// The guild ID
// v
client.leave_guild("794326789480120374");
// The channel ID

@@ -48,2 +66,9 @@ // v

// The channel ID
// v
client.delete_message("794339629553156116", "794329000897806387");
// ^
// Target message ID
// The channel ID

@@ -54,4 +79,6 @@ // v

```
**Keep in mind that all of these functions return Promises when they are finished execpt for type and stopType.**
**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.**

@@ -85,2 +112,6 @@ # Event listeners

client.on.guild_join: function (guild) { }, // Will be used when a guild is added to your user
client.on.guild_leave: function (guild) { }, // Will be used when a guild is removed from your user
```

@@ -139,3 +170,3 @@

# Now here are thoes Properties in a more readable form:
# Now here are those properties in a more readable form:
```js

@@ -142,0 +173,0 @@

@@ -35,2 +35,4 @@ const fetch = require("node-fetch");

channel_update: function (message) { },
guild_join: function (message) { },
guild_leave: function (message) { },

@@ -41,5 +43,3 @@ /* I'll add these later...

channel_pins_update: function (message) { },
guild_create: function (message) { },
guild_update: function (message) { },
guild_delete: function (message) { },
guild_ban_add: function (message) { },

@@ -160,2 +160,9 @@ guild_ban_remove: function (message) { },

}
case "GUILD_CREATE": {
this.on.guild_join(message.d);
break;
}
case "GUILD_DELETE": {
this.on.guild_leave(message.d);
}

@@ -169,2 +176,3 @@ };

if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!limit || !channelid) return new Error("Invalid parameters");
return new Promise((res, rej) => {

@@ -187,3 +195,5 @@ fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/messages?limit=${limit}`, {

}).then((response) => {
res(true);
response.json().then(m => {
res(m);
});
});

@@ -193,4 +203,83 @@ });

async getguild(guildid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!guildid) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/guilds/${guildid}`, {
"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": "GET",
"mode": "cors",
"credentials": "include"
}).then((response) => {
response.json().then(m => {
res(m);
});
});
});
};
async join_guild(invite, trim = false) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!invite) return new Error("Invalid parameters");
if (trim) invite = invite.split("https://discord.gg/")[1];
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/invites/${invite}`, {
"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": "POST",
"mode": "cors"
}).then((response) => {
response.json().then(m => {
res(m);
});
});
});
};
async leave_guild(guildid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!guildid) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/users/@me/guilds/${guildid}`, {
"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);
});
});
};
async send(message, channelid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!message || !channelid) return new Error("Invalid parameters");
return new Promise((res, rej) => {

@@ -217,3 +306,5 @@ fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/messages`, {

}).then((response) => {
res(true);
response.json().then(m => {
res(m);
});
});

@@ -225,2 +316,3 @@ });

if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!message || !targetmessageid || !channelid) return new Error("Invalid parameters");
return new Promise((res, rej) => {

@@ -258,11 +350,38 @@ fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/messages`, {

"mode": "cors"
}).then((response) => {
response.json().then(m => {
res(m);
});
});
}).then((response) => {
res(true);
});
};
async delete_message(targetmessageid, channelid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!targetmessageid || !channelid) return new Error("Invalid parameters");
return new Promise((res, rej) => {
fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/messages/${targetmessageid}`, {
"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": "DELETE",
"mode": "cors",
"credentials": "include"
}).then((response) => {
res(response);
});
});
};
async type(channelid) {
if (this.ready_status === 0) return new Error("Client still in connecting state.");
if (!channelid) return new Error("Invalid parameters");
this.typingLoop = setInterval(() => {

@@ -269,0 +388,0 @@ fetch(`https://discord.com/api/${this.config.api}/channels/${channelid}/typing`, {

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