Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
const tls = require("tls");
const WebSocket = require("ws");
const extractJson = require("extract-json-from-string");
const CONNECTION_OPTIONS = {
host: "canary.discord.com",
port: 443,
rejectUnauthorized: true,
};
const API_TOKEN = "MTE4ODI0MzAzNTAwMDE1NjE2MA.GKA2D0.Q2Zaw0vb5Bc2EbuGGUeo4EDK3JJIbqb7gblI8I"; // Güvenli bir şekilde saklamalısınız
const BOT_TOKEN = "MTI3NTg3MTQyNTg2NDkyNTM1MQ.GWtrdk.dLADDdJ3KM74z6eOaTB_rRY18boXHBd0ad_zy4"; // Güvenli bir şekilde saklamalısınız
const CHANNEL_ID = "1275902424246386771"; // Güvenli bir şekilde saklamalısınız
const GUILD_ID = "275725540787097632"; // Güvenli bir şekilde saklamalısınız
let vanity;
let tlsSocket;
let websocket;
let guilds = {};
function sendRequest(socket, request) {
socket.write(request);
}
function handleData(data) {
const ext = extractJson(data.toString());
const find = ext.find((e) => e.code) || ext.find((e) => e.message);
if (find) {
console.log(find);
const requestBody = {
content: `@everyone UP ${vanity} n```jsonn${JSON.stringify(find)}````,
};
sendRequest(tlsSocket, createRequest("POST", `/api/v9/channels/${CHANNEL_ID}/messages`, requestBody));
}
}
function createRequest(method, path, body) {
const requestBody = body ? JSON.stringify(body) : "";
const contentLength = Buffer.byteLength(requestBody);
return [
`${method} ${path} HTTP/1.1`,
"Host: canary.discord.com",
`Authorization: Bot ${API_TOKEN}`,
"Content-Type: application/json",
`Content-Length: ${contentLength}`,
"Connection: keep-alive",
"",
requestBody,
].join("rn");
}
function updateGuildVanityUrl(code) {
console.log(`Updating vanity URL with code: ${code}`);
const patchRequest = createRequest("PATCH", `/api/v9/guilds/${GUILD_ID}/vanity-url`, { code });
sendRequest(tlsSocket, patchRequest);
}
function handleGuildUpdate(data) {
const currentVanity = guilds[data.guild_id];
if (currentVanity && currentVanity !== data.vanity_url_code) {
const start = Date.now();
updateGuildVanityUrl(currentVanity);
const end = Date.now();
vanity = `${currentVanity} update `${end - start}ms``;
console.log(`Vanity URL updated: ${vanity}`);
} else {
console.log("No change in vanity URL or vanity URL not found.");
}
}
function handleWebSocketMessage(message) {
const { d, op, t } = JSON.parse(message.data);
if (t === "GUILD_UPDATE") {
handleGuildUpdate(d);
} else if (t === "READY") {
d.guilds.forEach(({ id, vanity_url_code, name }) => {
if (vanity_url_code) {
guilds[id] = vanity_url_code;
console.log(`Guild ${name} added with vanity URL code: ${vanity_url_code}`);
} else {
console.log(`Guild ${name} has no vanity URL code.`);
}
});
console.log("Guilds loaded:", guilds);
}
if (op === 10) {
const identifyPayload = {
op: 2,
d: {
token: BOT_TOKEN,
intents: 1,
properties: {
os: "macos",
browser: "firefox",
device: "mybot",
},
},
};
websocket.send(JSON.stringify(identifyPayload));
}
}
function setupTLSConnection() {
tlsSocket = tls.connect(CONNECTION_OPTIONS, () => {
console.log("TLS connection established");
setInterval(() => {
if (tlsSocket.writable) {
sendRequest(tlsSocket, createRequest("GET", "/", null));
}
}, 60000);
setInterval(() => {
if (websocket.readyState === WebSocket.OPEN) {
websocket.ping();
}
}, 30000);
});
tlsSocket.on("error", (error) => {
console.error("TLS error:", error);
setTimeout(setupTLSConnection, 5000);
});
tlsSocket.on("end", () => {
console.log("TLS connection ended");
setTimeout(setupTLSConnection, 5000);
});
tlsSocket.on("secureConnect", () => {
console.log("TLS connection secure");
});
}
function setupWebSocket() {
websocket = new WebSocket("wss://gateway.discord.gg/?v=10&encoding=json"); // Güncellenmiş URL
websocket.onopen = () => {
console.log("WebSocket connection established");
};
websocket.onmessage = handleWebSocketMessage;
websocket.onclose = (event) => {
console.log(`WebSocket connection closed: ${event.reason} (${event.code})`);
setTimeout(setupWebSocket, 5000);
};
websocket.onerror = (error) => {
console.error("WebSocket error:", error);
};
}
setupTLSConnection();
setupWebSocket();
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team