├── tea.yaml ├── package.json ├── index.js └── README.md /tea.yaml: -------------------------------------------------------------------------------- 1 | # https://tea.xyz/what-is-this-file 2 | --- 3 | version: 1.0.0 4 | codeOwners: 5 | - '0x49D527BC61fDBA1Ca87e3df3FC1383f04E5f8ee4' 6 | quorum: 1 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dc-api", 3 | "version": "1.0.2", 4 | "description": "Simple SelfBot discord API wrapper", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/vsec7/dc-api.git" 12 | }, 13 | "keywords": [ 14 | "Discord", 15 | "Bot", 16 | "api-wrapper" 17 | ], 18 | "author": "Verry Darmawan", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/vsec7/dc-api/issues" 22 | }, 23 | "homepage": "https://github.com/vsec7/dc-api#readme", 24 | "dependencies": { 25 | "axios": "^0.26.1" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Simple Discord API Wrapper 5 | Created by Verry Darmawan (github.com/vsec7) 6 | 11/03/2022 7 | */ 8 | 9 | const axios = require('axios'); 10 | 11 | class Discord { 12 | constructor(token) { 13 | if (!token) throw new Error('Please provide discord token'); 14 | this.base = 'https://discord.com/api/v9'; 15 | this.auth = { headers: { 'authorization': token } }; 16 | } 17 | 18 | // GetMe() 19 | async GetMe() { 20 | const u = this.base +'/users/@me'; 21 | let r = await axios.get(u, this.auth) 22 | return r.data 23 | } 24 | 25 | // GetMessage(channel_id, limit) 26 | async GetMessage(c_id, l) { 27 | const u = this.base +'/channels/'+ c_id +'/messages?limit='+ l; 28 | let r = await axios.get(u, this.auth) 29 | return r.data 30 | } 31 | 32 | // SendMessage(channel_id, text) 33 | async SendMessage(c_id, txt) { 34 | let d = { content: txt }; 35 | const u = this.base +'/channels/'+ c_id +'/messages'; 36 | let r = await axios.post(u, d, this.auth) 37 | return r.data 38 | } 39 | 40 | // ReplyMessage(channel_id, message_id, text) 41 | async ReplyMessage(c_id, m_id, txt) { 42 | let d = { 43 | content: txt, 44 | message_reference: { 45 | message_id: m_id 46 | } 47 | }; 48 | const u = this.base +'/channels/'+ c_id +'/messages'; 49 | let r = await axios.post(u, d, this.auth) 50 | return r.data 51 | } 52 | 53 | // DeleteMessage(channel_id, message_id) 54 | async DeleteMessage(c_id, m_id) { 55 | const u = this.base +'/channels/'+ c_id +'/messages/'+ m_id; 56 | let r = await axios.delete(u, this.auth) 57 | return r.data 58 | } 59 | 60 | // JoinGuild(invite_code) 61 | async JoinGuild(c) { 62 | let d = {}; 63 | const u = this.base +'/invites/'+ c; 64 | let r = await axios.post(u, d, this.auth) 65 | return r.data 66 | } 67 | 68 | // LeaveGuild(guild_id) 69 | async LeaveGuild(i) { 70 | const u = this.base +'/users/@me/guilds/'+ i; 71 | let r = await axios.delete(u, this.auth) 72 | return r.data 73 | } 74 | 75 | } 76 | 77 | module.exports = Discord; 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simple Discord API Wrapper for Node.js 2 | 3 | NPM version 4 | NPM downloads 5 | 6 | A Node.js simple wrapper for the SelfBot Discord API 7 | 8 | *** NOTE : USE AT YOUR OWN RISK! *** 9 | 10 | ## • Installation 11 | 12 | Latest version: 1.0.2 13 | 14 | ```bash 15 | npm install dc-api 16 | ``` 17 | 18 | ## • Quick Example 19 | 20 | ```javascript 21 | //1. Import dc-api 22 | const Discord = require('dc-api'); 23 | 24 | //2. Initiate the Discord API 25 | const bot = new Discord("DISCORD_TOKEN"); 26 | 27 | //3. Make calls 28 | bot.GetMe().then( r => { console.log(r) }) 29 | ``` 30 | 31 | ## • How to get SelfBot Discord Token ? 32 | Copy and paste this javascript into url bar (while open discord on web) 33 | 34 | ``` 35 | javascript:var i = document.createElement('iframe');i.onload = function(){var localStorage = i.contentWindow.localStorage;prompt('DC Token By @github.com/vsec7', localStorage.getItem('token').replace(/["]+/g, ''));};document.body.appendChild(i); 36 | ``` 37 | 38 | ## • Feature Functions 39 | 40 | - ***GetMe()*** 41 | 42 | Get authenticated user info from token 43 | ```javascript 44 | bot.GetMe() 45 | 46 | ``` 47 | 48 | - ***GetMessage()*** 49 | 50 | Get message from channel 51 | ```javascript 52 | bot.GetMessage(channel_id, limit) 53 | 54 | ``` 55 | 56 | - ***SendMessage()*** 57 | 58 | Send message to channel 59 | ```javascript 60 | bot.SendMessage(channel_id, text_message) 61 | 62 | ``` 63 | 64 | - ***ReplyMessage()*** 65 | 66 | Reply message to channel 67 | ```javascript 68 | bot.ReplyMessage(channel_id, message_id, text_message) 69 | 70 | ``` 71 | 72 | - ***DeleteMessage()*** 73 | 74 | Delete message from channel 75 | ```javascript 76 | bot.DeleteMessage(channel_id, message_id) 77 | 78 | ``` 79 | 80 | - ***JoinGuild()*** 81 | 82 | Join server guild 83 | ```javascript 84 | bot.JoinGuild(invite_code) 85 | 86 | ``` 87 | 88 | - ***LeaveGuild()*** 89 | 90 | Leave server guild 91 | ```javascript 92 | bot.LeaveGuild(guild_id) 93 | 94 | ``` 95 | 96 | ## Donation : 97 | 98 | Solana Address: viloid.sol 99 | 100 | ETH/BSC Address: 0xd3de361b186cc2Fc0C77764E30103F104a6d6D07 --------------------------------------------------------------------------------