A barebones Discord Gateway library made with account tokens in mind.
MiniGatewayLib is a NodeJS library made for JellyfinRPC to interact with the Discord Gateway via an account token.
It currently supports making a base connection to the Discord Gateway and setting an RPC Activity. I don't plan on making this a full fledged library for userbots as it is honestly out of my scope since there are many things to count when making REST requests to the (user) Discord API.
Caution
While I never had any issues with the library after using it for a few months, I cannot guarantee that your account will be 100% safe as userbots are against the Discord TOS, therefore I don't take any responsibility for blocked Discord accounts in case a block might happen!
npm install https://github.com/AntogamerYT/MiniGatewayLibimport { Client, RPCActivity, RPCActivityType } from 'minigatewaylib'
const client = new Client("TOKEN");
client.once("ready", async () => {
console.log(`Logged in as ${client.user.username}.`)
const activity = new RPCActivity({
afk: false,
status: "dnd",
activities: [{
name: "deez nuts",
type: RPCActivityType.Watching,
details: "Watching Deez Nuts via MiniGatewayLib",
timestamps: {
start: Date.now(),
end: Date.now() + 1000 * 60 * 60 // 1 hour
},
application_id: "123456789012345678", // Needed to set buttons and images/assets
buttons: [
{
label: "Click me!",
url: "https://example.com"
}
]
}]
})
client.rpc.setActivity(activity)
console.log("Activity set successfully")
})
client.on("resumed", () => {
console.log("A connection to the Discord Gateway has been resumed.")
})
// Recommended since it gracefully logs out of the Gateway sessions, meaning that Discord will instantly clear the activity
process.on("SIGINT", () => {
console.log("Ctrl C Detected, attempting graceful logout")
if (client.gateway.ready) {
client.logout();
}
process.exit(0)
})
await client.login();