Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sleep_ms(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- function player_name() {
- return document.getElementById('stein-player-name-panel').textContent;
- }
- async function send_text(text) {
- let token = '-/-';
- await fetch('https://api.telegram.org/bot' + token + '/sendMessage?' +
- new URLSearchParams({chat_id: '0-0', text: text}));
- }
- function prof_list() {
- return document.getElementById('stein-professions-recipe-list');
- }
- function prof_count() {
- return prof_list().childElementCount;
- }
- async function count_all_profs() {
- const profs = document.getElementsByClassName("stein-professions-side-bar-entry button");
- let count = 0;
- for (const prof of profs) {
- prof.click();
- await sleep_ms(150);
- count += prof_count();
- }
- return count;
- }
- async function send_all_profs() {
- const profs = document.getElementsByClassName("stein-professions-side-bar-entry button");
- for (const prof of profs) {
- prof.click();
- await sleep_ms(150);
- let result = player_name() + '\n';
- for (const e of prof_list().children) {
- if (result.length > 3000) {
- send_text(result);
- result = player_name() + '\n';
- }
- let text = e.textContent;
- if (e.childElementCount == 3) {
- text = e.children[0].textContent + e.children[2].textContent;
- }
- result += text + '\n';
- }
- if (result) {
- send_text(result);
- }
- }
- }
- console.log(await count_all_profs());
- await send_all_profs();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement