Changelog for FASearchBot, should include entries for these types of changes:
Added
for new features.Changed
for changes in existing functionality.Deprecated
for soon-to-be removed features.Removed
for now removed features.Fixed
for any bug fixes.Security
in case of vulnerabilities. Format inspired by https://keepachangelog.com/en/1.0.0/
- Handle fxraffinity.net links as if they're furaffinity.net ones
- Handling http 522 status code when attempting to download media in the media fetcher, and retrying after a short wait
- Media fetcher will now correctly handle http 520 and 403 responses from FA CDN
- Subscription watcher will now give up if it has been unsuccessful at fetching media for a submission over 100 times.
- Fixing a bodged refactor and putting the query parser back inside fa_search_bot
- If subscription watcher gets 502 error while downloading media, backoff and try again
- If a story submission lacks a preview image, try using the thumbnail image instead. This should avoid the subscription watcher ending up in a cycle passing a submission back and forth between data fetcher and media fetcher.
- Instead of skipping submissions when the media returns 404, the media fetcher will push them back to the data fetcher to fetch the data again, in case the submission's media URL has changed, rather than the submission being deleted.
- Correctly handle 404 during submission upload in the subscription watcher
- Raise exception if unexpected status code received while downloading image. (May lower reliability until we find out where these exceptions get raised)
- Increase reliability of neaten functionality, by making it retry after cloudflare/slowdown errors a few times
- Detect 429 responses from FAExport, as well as 503 ones. Also use error_type for error identification
- If an image won't load, or save, in PIL, attempt to load it with the LOAD_TRUNCATED_IMAGES flag set.
- Change
fasearchbot_fasubwatcher_latest_posted_at_unixtime
metric to record the FA posted timestamp of the last submission sent by the subscription Sender, rather than the last one whose data was fetched by the DataFetcher. - MediaFetcher will attempt to re-upload to Telegram if it gets a ClientPayloadError during upload
- Added the ability for the bot to lookup some submissions by filename, allowing automatically embedded FA gifs to be optimised, or downloaded e621 files to be looked up.
- Fixed slow heartbeat from SubIDGatherer which was leading to excess alerts.
- Fixed race condition where submissions could be delivered to deleted subscriptions if they were still in the queue.
- Huge rewrite of the logic of the subscription watcher. Instead of doing everything sequentially, it now has a 4 part process of different tasks passing data across in queues. First task gathers new submission IDs, second task fetches the data for those IDs and checks subscriptions, third task downloads media and uploads to telegram, fourth task sends telegram messages. The fourth task always ensures messages are sent to telegram in the order they are published to FA, while allowing the second and third tasks to be scaled out to run in parallel to multiple copies of eachother. This should improve throughput a fair bit!
- FAExportAPI web requests are all async now, rather than blocking.
- Metrics will have changed a lot in the fasearchbot_fasubwatcher_* area.
- Four heartbeats, one for each task.
- If a submission fails to process, the subscription watcher shuts down rather than skipping one. Hopefully it shouldn't fail to process!
- If FA browse page is unavailable for the subscription watcher (such as during cloudflare protection), try using the home page, as we only want the latest submission ID anyway.
- Added support for neatening and embedding Weasyl submission links
- Correctly record metrics for how long it takes to upload audio and image submissions, rather than just videos
- Correctly handling submission links which have been deleted from e621
- Removed call to
str.removeprefix()
which caused issues with older python versions
- Fixed two pass video conversion
- Added thumbnails to sent videos
- Fixed bug where inline search might report no results exist at the end of a search
- Fixed bug where submissions sent by fallback methods would be cached
- Only download images once when sending them, hopefully speeding things up
- Setting better filenames on videos and gifs (with site and submission ID)
- Setting title and performer on audio files sent by the bot
- Separating the methods for uploading media to telegram and sending it as a message, allowing future performance improvements
- Fixed bug where gifs could not be sent via inline neatening. (Fixes sending audio and pdf also)
- When sending submissions that have already been cached as full results, inline result will be sent correctly first time, rather than having an optimise button and calling inline edit.
- Added metrics on time taken by various steps of sending a fresh message,
fasearchbot_sendable_time_taken
- Added metrics on cache database size,
fasearchbot_db_cache_entries
- Added metrics on saving and loading cache, cache hits and misses, to submission cache,
fasearchbot_submissioncache_*
- Added metrics on inline query result counts, cached and fresh,
fasearchbot_inline_*_results_count
- Improved reliability of inline search, returning smaller batches of fresh results for speed, but sending larger batches of cached results if available.
- Added new metric,
fasearchbot_sentsubmission_sent_from_cache_total
storing how many messages are sent from cache.
- Subscription watcher to handle PeerIdInvalidError by pausing all subscriptions to that peer.
- Subscription watcher will now send from cache correctly
- Added a cache database that stores the file ID of all images sent in telegram, so that they can be sent much faster the second time. This also came with a big refactor of the internals and site handling and such. Should make inline queries more reliable too! (By virtue of being faster)
- Added a prometheus metric
fasearchbot_fasubwatcher_time_taken
, which is logging the time taken by the subscription watcher performing various tasks. This merges the metric series which were added in version 1.12.5.
- Removed the older metric series of the form
fasearchbot_fasubwatcher_time_taken_*
, to merge them all into one metric series with individual labels for different tasks
- Added a series of prometheus metrics to the subscription watcher, logging the time taken by various stages of the
subscription watcher's process. These are all of the form
fasearchbot_fasubwatcher_time_taken_*
- Added a prometheus metric
fasearchbot_fasubwatcher_latest_posted_at_unixtime
, which is the unix timestamp that the latest processed submission was uploaded to FA
- Removed the
fasearchbot_fasubwatcher_backlog_seconds
metric, which may become outdated or misleading
- Added a prometheus metric
fasearchbot_fasubwatcher_backlog_seconds
, which says how many seconds old the latest submission checked by the subscription watcher is. (i.e. how many seconds since it was posted on FA)
- Added a prometheus metric
fasearchbot_fasubwatcher_subscription_destination_count_active
, which says how many destinations have at least one active subscription
- Subscriptions will now be paused when the bot cannot access a channel
- Ability to do inline e621 searches
- Split apart inline functionality classes, for easier modification of gallery, search, and favourite inline queries
- Updating direct indirect dependencies to fix security alerts. I don't believe any of these would pose serious security issues for this project.
- Adding
g:
shortcode for inline user gallery searches - Adding
f:
shortcode for inline user favourite searches
- Add support for neatening e621 thumbnail links
- Add support for e926 links
- Subscription terms which don't specify a field can now match the artist name
- Add
fasearchbot_log_messages_total
metrics on log line counts by level
- Added
fasearchbot_faapi_latest_id
metric, keeping note on the latest FA submission ID
- Renamed
fasearchbot_fasubwatcher_updates_failed
metric tofasearchbot_fasubwatcher_updates_failed_total
- Fixing
fasearchbot_faapi_cloudflare_errors_total
metric, which had incorrect label naming
- Lots of prometheus metrics on:
- Running bot version and start up time
- Functionality usage
- API timings and error rates
- Whether FA is in slow mode
- Sent message counts and types
- Gif and video conversion timings, error rates, and whether one or two pass conversion was required
- Video types, lengths, and whether they have audio
- Docker timings and error rates
- Submissions processed by subscription handler, error rates and types, and rates of submissions which match subscriptions
- Number of subscriptions and block lists, and destinations those are configured for
- Backlog of submissions which need checking against subscriptions, and what time the last one was checked
- Added
prometheus_port
option to config to specify which port to run the metrics endpoint on, defaulting to 7065 - Supporting MD5 hashes as IDs for e621 submissions
- Removed the usage logger at
logs-usage.log
(in favour of prometheus metrics)
- Added e621 configuration to the config file. Set
e621
to a dictionary containingusername
andpassword
keys.- This is so that the bot can access e621 posts which are not available to guests
- Stop subscription watcher faster when told to stop (after the next submission, rather than after the next batch)
- Convert videos without audio which are over 40 seconds into videos, not gifs
- Handle images lacking an "is_animated" attribute, in case an image is named with the wrong file extension
- Adding notes about e621 posts to welcome message
- Improve railroad diagram generation script
- Fixed two-pass video conversion such that it accommodates audio bitrate in its calculation of target video bitrate so that resulting videos are not above telegram size limits
- Added support for e621
- Reworking a lot of functionalities to handle e621 links
- Creating Sendable to provide generic ways for functionalities to send submissions from different sites
- Fixed version number parsing to be a little less fragile
- In groups, neaten functionality should ignore gif and video captions, as well as image captions
- If a destination is removed, or the bot is blocked from it, pause all subscriptions to that destination
- Edit inline query messages after they are sent, to raise the quality level
- Fixed loading of subscription data
- If subscription data file is empty, treat it as if it does not exist
- Adding title and author to non-image submissions (such as stories and music)
- Convert static gifs to png, so that telegram doesn't treat them as animated
- Separate github actions job for unit tests from telegram integration tests
- Creating website integration tests folder, for cases where we want to ensure a website behaves the same as we have assumed
- Handle gif conversions asynchronously, so it does not block all other actions
- Added the ability to send individual submissions by passing the link or ID to an inline query
- Creating generic SiteHandler base, and FAHandler implementation, laying the groundwork for supporting other websites
- Removed no longer used python-telegram-bot dependency
- Neaten now works in megagroups as well as groups
- Fixed gallery display in inline photo query on mobile
- Switch from python-telegram-bot to Telethon
- Allowing asynchronous operation
- Better handling of flood limits
- Better handling of errors when sending messages
- Switch subscription watcher from a separate thread, to an asynchronous task
- No longer ignoring images with url buttons and no caption
- Better handling and clarity around cloudflare errors
- Fixed handling of messages without URL buttons
- Recommending @reverseSearchBot for looking up sources of gifs
- Checking URL buttons for links when messages are sent to the bot for neatening
- Replying to the unhandled message when warning that a message is unhandled
- No longer considering hypens and underscores to be word boundaries when checking subscription matches
- Only log usage of image hash recommend functionality in private message
- Switch from travis CI to github actions
- Switch to handling furaffinity.net direct and thumbnail links, as well as the old facdn.net links
- Handling FA submissions without thumbnails
- Improved logging for deleted submissions in subscription watcher
- Checking all submission IDs, rather than just the ones on browse listings, so that we don't miss scraps
- Telegram integration tests running a full copy of the bot at a staging handle and sending messages to it
- Added notes on pause and resume functionality to readme
- Shutdown process closes all threads
- Fixed error where migrated chat would not recognise duplicate subscriptions
- CodeQL static analysis
- Subscriptions can now be configured in channels
- Requirements and tasks are now managed via poetry, rather than requirements.txt anbd makefile
- Will no longer try and neaten links in channels, or links from image captions in groups
- Experiment results on maximum telegram gif resolutions
- Increased the maximum size of gifs to 1280x1280, (from 720x720)
- Now supporting new d2.facdn and t2.facdn direct links
- Experiment on maximum telegram image resolutions
- Made sending photos a bit more resilient, as random URLs seem to fail to embed in telegram bot API
- Checking registered users count on FA, and slowing down if site is in slowdown mode
- Migrate chat subscriptions if a group is upgraded to supergroup
- Added
except
keyword to subscription queries, such that wildcard queries can have exceptions they do not match
- Moved run.py out of the package and into the root directory
- Added lots of logging and usage logging
- Extracted MQBot class into a separate file
- Message formatting errors for subscriptions with underscores, by switching from markdown to html message formatting
- Moved everything into fa_search_bot package
- Added link to FoxBot source code in readme
- Better handling of large images so that if they fail to send, a smaller version will be sent
- Bot now sends prettier and better telegram-optimised gifs by using dockerised ffmpeg to convert them to mp4 files
- Funding link: ko-fi
- Making prefix and suffix subscription queries not match if the whole word is equal to the specified prefix/suffix
- Complex subscription query parsing, with and/or, fields, phrases, ratings, prefix/suffix, and all sorts
- Added an experiment on doing this with whoosh, but ended up abandoning that and using pyparsing and custom matching
- If a submission matches multiple subscriptions in one chat, only one message is sent, with the list of matching subscriptions
- Added @FoxBot to the list of recommended bots to locate image sources, alongside @FindFurryPicBot
- Added "!" as a negation modifier, alongside "-", for subscriptions
- Allow subscriptions to be configured in channels
- Subscriptions can now specify the rating of submissions
- Renaming block list functionality
- Default to faexport.spangle.org.uk rather than faexport.boothale.net
- Fix github repository link in welcome message
- Added an error message when an unhandled message is sent to the bot
- Added github link to the welcome message
- Added in progress messages while the bot is searching for submission to neaten
- Neatening up tests
- Subscription watcher should shutdown more quickly when asked to stop
- Fixing a bug that resulted in repeats when API was down, and instead keeps trying until API returns
- Updating python-telegram-bot
- Converting tests to pytest
- Subscription watcher will shutdown faster when asked to stop
- Network issues when getting new results will no longer kill subscription watcher
- Writing subscription data to temp file, so that running out of disc space doesn't lead to data loss
- Adding heartbeat pings to subscription watcher, so that downtime can be monitored
- Moving remaining filters around, merging changes from 1.2.9
- Fixing the filter used for image hash recommendation
- Recommending @FindFurryPicBot to find image sources, if they are sent without a link
- Pulling all functionality classes and filter classes out into their own files
- Don't repost submissions on bot restart, save latest submission IDs after every post
- Use message queue to avoid messages hitting flood limit and failing to send
- Load and send submissions one by one, rather than waiting to load them all before sending any to subscriptions
- Fixing "list changed size during iteration" error in subscription watcher by copying subscription list before iterating it
- Bot should now respond to commands with the username appended to them, such as commands sent in groups
- List subscriptions command should list them in order
- Speed up subscription watcher by fetching all submissions before checking subscriptions
- Adding prefix to subscription result posts, rather than having a separate message saying which subscription the submission was posted for
- Adding retry logic to the FA API handler, to handle intermittent errors
- Initial version number
- Rest of the bot, technically.