py-clash-bot icon indicating copy to clipboard operation
py-clash-bot copied to clipboard

Add discord webhook support

Open tsIsFried opened this issue 2 months ago • 3 comments

Description

Adds Discord webhook support to py-clash-bot, allowing users to receive real-time notifications about bot activity directly in Discord.

Changes Made

  • Added DiscordWebhook utility class for sending notifications
  • Integrated webhook notifications into logger for key events:
    • Bot started/stopped
    • Battle wins/losses
    • Error notifications
  • Added Discord webhook URL field to UI (Misc tab)
  • Updated dependencies to include requests package
  • Added comprehensive documentation in README.md

Features

  • Real-time Discord notifications for bot events
  • Optional feature (can be disabled by leaving field empty)
  • Non-blocking async notifications
  • Graceful error handling (bot continues if webhook fails)
  • Privacy-focused (webhook URLs stored locally only)

Testing

  • [x] Tested Discord webhook notifications work correctly
  • [x] Verified bot continues operating if webhook fails
  • [x] Confirmed webhook URL is saved and persists between sessions
  • [x] Tested all notification types (start, stop, wins, losses, errors)

Documentation

  • [x] Updated README.md with setup instructions
  • [x] Added examples and usage notes
  • [x] Code includes comprehensive docstrings

tsIsFried avatar Nov 04 '25 03:11 tsIsFried

I liked this when it was 400 lines. It crept out of scope and is now squeezing in features unrelated to discord webhooks. I would prefer if it were broken up, one PR per feature.

martinmiglio avatar Nov 04 '25 05:11 martinmiglio

Yes it was a full mistake I pushed to the same branch on accident I'm not at my computer rn so I can't change anything tonight but will within a day

tsIsFried avatar Nov 04 '25 05:11 tsIsFried

I was planning on making a new pull for deck to send the deck stuff to a website and have that in the background for more deck images

tsIsFried avatar Nov 05 '25 01:11 tsIsFried