@imaentity/selfjs 1.3.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/docs.md +1 -1
  2. package/package.json +1 -1
  3. package/self.js +17 -4
package/docs.md CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  - **getRoles(serverID, userID)**: Gets the roles for a user in a server.
24
24
 
25
- - **uploadFile(channelID, fileName, msgContent = "", messageID = null)**: Uploads a file to the specified channel.
25
+ - **uploadFile(channelID, fileName, isSpoiled = false, msgContent = "", messageID = null)**: Uploads a file to the specified channel.
26
26
 
27
27
  - **search(channelID, options)**: Search for messages in a channel based on the specified options.
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaentity/selfjs",
3
- "version": "1.3.7",
3
+ "version": "1.4.8",
4
4
  "description": "Breaking Discord's TOS to bot user accounts.",
5
5
  "main": "self.js",
6
6
  "repository": {
package/self.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @name SelfJS
3
3
  * @description Breaking Discord's TOS to bot user accounts.
4
4
  * @author Эмберс
5
- * @version 1.3.7
5
+ * @version 1.4.8
6
6
  */
7
7
 
8
8
  const https = require("https");
@@ -255,7 +255,7 @@ module.exports = {
255
255
  });
256
256
  }
257
257
 
258
- uploadFile(channelID, fileName, msgContent = "", messageID = null) {
258
+ uploadFile(channelID, fileName, isSpoiled = false, msgContent = "", messageID = null) {
259
259
  const fileData = fs.readFileSync(fileName);
260
260
 
261
261
  if(fileData.length >= 26214400) return null;
@@ -344,7 +344,7 @@ module.exports = {
344
344
  attachments: [
345
345
  {
346
346
  id: '0',
347
- filename: fileName,
347
+ filename: (isSpoiled ? "SPOILER_" : "") + fileName,
348
348
  uploaded_filename: requestResData.attachments[0].upload_filename
349
349
  }
350
350
  ]
@@ -619,8 +619,21 @@ module.exports = {
619
619
  }
620
620
 
621
621
  leaveChannel(channelID) {
622
+ const options = {
623
+ ...module.exports.APIBaseOpt,
624
+ method: "DELETE",
625
+ path: `/api/v10/channels/${channelID}`,
626
+ headers: {
627
+ "Authorization": this.token
628
+ }
629
+ };
630
+
622
631
  return new Promise(function(resolve) {
623
- this.removeFromChannel(channelID, this.userID).then(resolve);
632
+ const req = https.request(options, function(res) {
633
+ res.on("end", resolve);
634
+ });
635
+
636
+ req.end();
624
637
  }.bind(this));
625
638
  }
626
639