Created
June 7, 2023 07:44
-
-
Save g1ver/8f004db0f8341b965faed0ce3eef4694 to your computer and use it in GitHub Desktop.
discord name trying script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namelist = [] // names here | |
async function processNames() { | |
for (const name of namelist) { | |
try { | |
const res = await makeRequest(name); | |
if (res.ok) { | |
console.log(`Username ${name} is available.`); | |
break; | |
} | |
} catch (error) { | |
console.error(`An error occurred while processing username ${name}:`, error); | |
} | |
} | |
} | |
async function makeRequest(name) { | |
const res = await fetch("https://discord.com/api/v9/users/@me", { | |
// config, get from network tab of devtools after trying to change name | |
}); | |
if (res.ok) { | |
return res; | |
} else if (res.status === 429) { | |
const retryAfter = res.headers.get('Retry-After'); | |
const delay = retryAfter ? parseInt(retryAfter) * 1000 : 1000; // default delay of 1 second | |
console.log(`Rate limit exceeded. Retrying after ${delay / 1000} seconds.`); | |
await sleep(delay); // wait for the specified delay before retrying | |
return makeRequest(name); // retry the request | |
} else { | |
throw new Error(`Request failed with status ${res.status}`); | |
} | |
} | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
processNames(); |
I found this API endpoint that can be used to test for available names: https://discord.com/api/v9/users/@me/pomelo-attempt
It seems to only be available to users who have been granted access to pick a new name, but haven't locked in a new one. So, if you want to check for a lot of names, do not register a new username before checking; otherwise, you will lose access to this endpoint.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New Discord names are out. Use this script to automatically try a bunch of names.
Here are the name constraints:
NOTE: You can only change your name once every two hours.
I'm sure name checking can be done through the API, but this was a quick solution.