Get Discord token and copy to clipboard
// ==UserScript==
// @name Discord Token Getter
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Get Discord token and copy to clipboard
// @author Chaython
// @homepageURL https://github.com/chaython
// @match https://discord.com/*
// @grant GM_addStyle
// @grant GM_notification
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
// Add custom styles for the button
GM_addStyle(`
.token-button {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9999;
padding: 10px 15px;
background-color: #5865f2;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 500;
transition: background-color 0.2s;
}
.token-button:hover {
background-color: #4752c4;
}
`);
// Create and inject the button
const button = document.createElement('button');
button.className = 'token-button';
button.textContent = 'Get Token';
document.body.appendChild(button);
// Add click handler
button.addEventListener('click', async () => {
try {
// Extract token using Webpack inspection
const token = window.eval(`
(webpackChunkdiscord_app.push([[''], {}, e => {
m = [];
for (let c in e.c) m.push(e.c[c]);
}]), m).find(m => m?.exports?.default?.getToken !== void 0).exports.default.getToken()
`);
// Copy to clipboard
await navigator.clipboard.writeText(token);
// Show notification
GM_notification({
title: 'Token Copied',
text: 'Discord token copied to clipboard!',
silent: true
});
// Log to console
console.log('%c[Token]', 'color: #5865f2; font-weight: bold;', token);
} catch (error) {
console.error('Error retrieving token:', error);
GM_notification({
title: 'Token Error',
text: 'Failed to retrieve token. Check console for details.',
silent: false
});
}
});
})();