Skip to content

Conversation

@swordfish6975
Copy link

Two new true/false settings:

DISCORD_DIFF_NOTIFICATIONS
TELEGRAM_DIFF_NOTIFICATIONS

Also added a check for subscribing to telegram, if you're already subscribed it will just tell you instead of adding you to the sqlite database again (this would cause multiple notification spam previously).

I have done more testing on the telegram side of things as I don't use the discord part.

@swordfish6975
Copy link
Author

Screenshot_2025-01-23-12-59-59-488_org telegram messenger

@benjamin-wilson
Copy link
Owner

Could you test of of the changes I made, just cleaned up a few things

@swordfish6975
Copy link
Author

looks good, thought it wasn't working but forgot I had to subscribe again 🤣 as I cleared the database.

just got a telegram message for this one :)
image

@warioishere
Copy link
Contributor

warioishere commented Apr 30, 2025

hi @swordfish6975 , thanks for this nice PR, testing this out on our public-pool server.
It seems its showing bestdiff values of each miner (two registered on that btc adresse) would be nice if the bot only shows best diff of alle shares coming from that btc adress, instead of every miner registered on that adress, what do you think?

grafik

@warioishere
Copy link
Contributor

Another improvement would/could be, that when using the TG bot, another option like /unsubscribe bestdiff could be useful for people not wanting this feature.

Greetings

@swordfish6975
Copy link
Author

swordfish6975 commented Apr 30, 2025

@warioishere cool to see that your testing it out.

Some of what your asking for might just be that I put the trigger line, at Line 545.

await this.notificationService.notifySubscribersBestDiff(this.clientAuthorization.address, submissionDifficulty);

Perhaps if i put it inside the other if statement at line (above or below) 550

await this.addressSettingsService.updateBestDifficulty(this.clientAuthorization.address, submissionDifficulty, this.entity.userAgent);

It would probably be way less spamy, though I have come to get used to the flury of diff notifications on the odd occasion the wifi drops to my miner 😂

@warioishere
Copy link
Contributor

warioishere commented Apr 30, 2025

This logic can be implemented in the Telegram bot itself, by maintaining a simple in-memory Map<string, number> like so:

private bestDiffCache: Map<string, number> = new Map();

public async notifySubscribersBestDiff(address: string, submissionDifficulty: number) {
    const currentBest = this.bestDiffCache.get(address) ?? 0;

    if (submissionDifficulty > currentBest) {
        this.bestDiffCache.set(address, submissionDifficulty);
        // Send Telegram message to subscribers
    }
}

This avoids spam and ensures that users only receive updates when a real improvement is found.

Make it way less spamy
@swordfish6975
Copy link
Author

swordfish6975 commented May 8, 2025

ive just moved the trigger line as I belive that is the simplest change to make it folow this box now (thats what I originally intended to do)

image

I will do some more testing to see if it stops spaming on miner disconnect/server restart now also.

@swordfish6975
Copy link
Author

just rebooted my miner it had prevously found:
image

I didnt get any notification spam :)

I will report back once it beats the 1.36G :)

@swordfish6975
Copy link
Author

that last change seemed to do the trick, no more spam on miner restart or if the wifi drops.

only got notifed when this changed from 1.36G to
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants