Skip to content

Instantly share code, notes, and snippets.

@luluwaffless
Last active December 1, 2025 01:35
Show Gist options
  • Select an option

  • Save luluwaffless/7675e079d8c7b3b3649f09d49edd51da to your computer and use it in GitHub Desktop.

Select an option

Save luluwaffless/7675e079d8c7b3b3649f09d49edd51da to your computer and use it in GitHub Desktop.
A script to quickly decline all friend requests to your account on Roblox.
/*
A script to quickly decline all friend requests to your account on Roblox.
Copyright (C) 2025 luluwaffless
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import axios from "axios";
axios.defaults.headers.common['Accept'] = 'application/json';
axios.defaults.headers.common['Cookie'] = `.ROBLOSECURITY=${process.env.COOKIE}`;
(async () => {
const li = await axios.get('https://users.roblox.com/v1/users/authenticated');
const { displayName, name } = li.data;
console.log(`logged in as ${displayName} (@${name})!`);
const getIds = async (cursor, ids = []) => {
const fl = await axios.get(`https://friends.roblox.com/v1/my/friends/requests?limit=100&friendRequestSort=1${cursor ? `&cursor=${cursor}` : ""}`);
const { nextPageCursor, data } = fl.data;
data.map(u => u.id).forEach(id => {
if (!ids.includes(id)) ids.push(id);
});
if (nextPageCursor && nextPageCursor !== cursor) return getIds(nextPageCursor, ids);
else return ids;
};
console.log("getting IDs...")
const ids = await getIds();
console.log(`received ${ids.length} IDs!\nstarting cleanup...`);
for (let i = 0; i < ids.length; i++) {
console.log(`declining ${ids[i]}...`);
try {
const dr = await axios.post(`https://friends.roblox.com/v1/users/${ids[i]}/decline-friend-request`);
console.log(`declined successfully! (${i + 1}/${ids.length})`);
} catch (e) {
if (e.response) {
if (e.response.data.errors[0].message === "XSRF token invalid") {
axios.defaults.headers.common['x-csrf-token'] = e.response.headers['x-csrf-token'];
console.log(`error due to invalid CSRF token, setting received CSRF token (${e.response.headers['x-csrf-token']}) and retrying`);
};
i--;
} else throw e;
};
};
})();
{
"name": "declinefriendrequests",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node --env-file=.env ."
},
"dependencies": {
"axios": "^1.13.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment