Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Direct HF/Discord interaction.

Was just testing some stuff and came up with this.
Could easily implement avatars, etc but was just wanting to test it.

IMPORTANT. It doesn't abuse HF. Right now it just uses your browser session and every time it gets a new message in convo sends it to the discord webhook.

[Image: kfSAzzA.gif]



Any javascript geniuses wanna make it work for double posts by a user and implement avatars for the bots you can do it. Here is the code. I give up.

1. Install tamper monkey in your browser.
2. Add the below code to tamper monkey.
3. Go to discord and make a server.
4. In server settings in discord click on Apps > Integrations > Webhoooks.
5. Paste that URL for the webhook into the tamper monkey script.
6. Go to the convo page in your browser and it will begin.

Code
// ==UserScript==
// @name     HackForums Chat
// @version  1
// @grant    none
// @match    https://hackforums.net/convo.php
// ==/UserScript==

(function() {
    'use strict';

    const WEBHOOK_URL = 'WEBHOOKGOESHERE';
    let lastUid = null;
    let lastUsername = null;

    function fetchLatestMessages() {
        let allMessages = Array.from(document.querySelectorAll('.message-convo-left, .message-convo-right'));
        let newMessages = [];
        for (let i = allMessages.length - 1; i >= 0; i--) {
            if (allMessages[i].getAttribute('data-uid') !== lastUid) {
                newMessages.unshift(allMessages[i]);
            } else {
                break;
            }
        }
        return newMessages;
    }

    function sendToWebhook(username, message) {
        fetch(WEBHOOK_URL, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                username: username,
                content: message,
            }),
        }).catch((error) => {
            console.error(`Error sending message to webhook: ${error}`);
        });
    }

    setInterval(() => {
        let latestMessages = fetchLatestMessages();
        for (let latestMessage of latestMessages) {
            let currentUid = latestMessage.getAttribute('data-uid');

            let usernameDiv = latestMessage.querySelector('.message-bubble-left a');
            let usernameFromAvatar = latestMessage.querySelector('.mirum-card-profile-info-username a span');

            let username;
            if (latestMessage.classList.contains('message-convo-right')) {
                username = "Mr. Robot";
            } else if (usernameDiv) {
                username = usernameDiv.textContent.trim();
                lastUsername = username; // Save the username for further use
            } else if (usernameFromAvatar) {
                username = usernameFromAvatar.textContent.trim();
                lastUsername = username; // Save the username for further use
            } else if (currentUid === lastUid && lastUsername) {
                username = lastUsername;
            } else {
                console.log("Could not find username for message: ", latestMessage);
                continue;
            }

            let messageDiv = latestMessage.querySelector('.message-bubble-message');
            if (messageDiv) {
                let message = messageDiv.textContent.trim();
                console.log(`New message from ${username}: ${message}`);
                sendToWebhook(username, message);
            }

            lastUid = currentUid;
        }
    }, 100);
})();


>> Notes:
1. It will already take URLs of images people post and embedd them nicely.
2. When someone uploads an image to chat it will be a base string which you can convert
3. Discord supports changing the bots avatars via the request so you can make it more realistic.


Maybe this will inspire you to use tampermonkey for web based projects into the discord hook - you'd just need a server on that website/page to do it. Or a tab on your browser accessing the site. Even then you technically don't have to if you tamper monkey every site you visit with an iframe of the site you are scraping etc etc but don't do that, that's naughty.
How did you do this with a webhook? That’s awesome I wanna do the same thing.
[Image: IMK3P8b6_o.png]
That's so clean for a webhook no delay's i like. You releasing it?
This is actually clean af, good job!

I don’t know if it’d get done, because then the convo function would be kinda useless imo
[Image: IMK3P8b6_o.png]
That looks pretty cool man
(Jul 18, 2023 08:29 AM)SIM-5367118 Wrote:  How did you do this with a webhook? That’s awesome I wanna do the same thing.

(Jul 18, 2023 08:43 AM)Stunner Wrote:  That's so clean for a webhook no delay's i like. You releasing it?

(Jul 18, 2023 08:47 AM)Neil Wrote:  This is actually clean af, good job!

I don’t know if it’d get done, because then the convo function would be kinda useless imo

(Jul 18, 2023 09:22 AM)darkedgylord Wrote:  That looks pretty cool man

Put my code up, needs some work to get avatars working as well as multiple messages from the same user.

I've done this before for an entire discord server, I made a tamper monkey script and used discord web and replicated every message from one server into my own.
(Jul 18, 2023 10:02 AM)-Scrub Wrote:  I have a full source from a listener that I had made also, it will copy everything from x server and paste it to x server, and the account that is in the discord that’s being “cloned” appears just as a normal member so the original owner of the server would never know. It works with avatars, links, pictures, etc. not sure if the same thing you’re doing here.

Not quite as mine is webhook based and will use the bot tag.
This is great! Love the hooks! Looking clean! I might take a crack at this for fun.
(Jul 18, 2023 11:28 AM)CtlAltAnon Wrote:  This is great! Love the hooks! Looking clean! I might take a crack at this for fun.

Would be great if I could be bothered working on it.
This is really cool, great work. Love to see the stuff you get up to.
Space echoes like an immense tomb, yet the stars still burn. Why does the sun take so long to die?
This looks really cool😊
Wow i think this is amazing feature to bring more activity to hf especially if people are sharing threads ect.
(Jul 18, 2023 09:12 PM)Migos Wrote:  Wow i think this is amazing feature to bring more activity to hf especially if people are sharing threads ect.

Not sure if it would have that much of an overall impact but anyone can take the code and use it now.
For anyone wondering, I gave up on this because the way HF handles avatar URLs - I can't send them to the discord server as profile pictures.
Elegance! Period. Code quickly is much easier than elegant.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by HackersFeb 19, 2026 01:20 AM 12 240 Feb 19, 2026 01:20 AM
Last Post: Jamika
by dhobsFeb 1, 2026 03:26 AM 0 158 Feb 1, 2026 03:26 AM
Last Post: dhobs
by Leroy Jethro GibbsMar 4, 2018 08:34 PM 2 317 Mar 4, 2018 08:34 PM
Last Post: ❤️BowmanBot❤️