Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created June 19, 2025 13:18
Show Gist options
  • Save SgtPooki/59fc5b888c999389b7fdf6b117b75332 to your computer and use it in GitHub Desktop.
Save SgtPooki/59fc5b888c999389b7fdf6b117b75332 to your computer and use it in GitHub Desktop.
get slack thread discussion for posting to github issues as quoted by each user
(() => {
const threads = document.querySelectorAll('[data-qa="slack_kit_list"]');
if (!threads || threads.length < 3) {
// note: when you click view thread, there are three "slack_kit_list" items: sidebar, main channel, thread
return console.error('Thread container not found (need at least 3)');
}
const thread = threads[2];
const msgs = thread.querySelectorAll('.c-message_kit__thread_message');
const result = Array.from(msgs)
.map(msg => {
const sender = msg.querySelector('[data-qa="message_sender"]')?.innerText.trim() || 'Unknown';
const time = msg.querySelector('.c-timestamp__label')?.innerText.trim() || '';
const bodyEl = msg.querySelector('div[data-qa="message-text"]');
const body = bodyEl?.innerText.trim() || '';
// prefix each line for GitHub quoting
const quotedBody = body
.split('\n')
.map(line => `> ${line}`)
.join('\n');
return `> **${sender} [${time}]**\n${quotedBody}`;
})
.filter(Boolean)
.join('\n\n');
console.log(result);
return result;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment