Skip to content

Releases: svioletg/lydian-discord-bot

v2.0.0-pre.3

06 Jul 20:23
Compare
Choose a tag to compare
v2.0.0-pre.3 Pre-release
Pre-release

This is a pre-release, and may not be fully stable or reliable for regular use. This changelog will continue to update until this release is stable.

dev.34

2024.07.07 (latest pre-release)

Developer

  • Docstrings have been added to most functions, classes, and modules
  • Any instances of import regex as re have been replaced with import re
  • customlog.py has been removed entirely, logging is now handled using the colorlog library (vMB #73)
    • Therefore, logs are no longer marked as verbose with a keyword argument, and instead use standard logging levels. Most logs that used verbose have been moved to DEBUG-level logs, but some have been deemed INFO-level instead
  • Changes in bot.py:
    • on_error client event added to handle non-command-related errors, finally
    • No longer have to use try/except blocks for 404 errors resulting from editing/deleting messages, the issue was that the reference variables weren't getting properly set to None when some_message.delete() was called, so the reference pointed to nothing
    • duration_from_url() and title_from_url() removed, any functions related to URL caching removed, now irrelevant
    • -test debug command added
    • -reload debug command removed
    • -analyze command removed
    • debugctx variable and -dctx command removed, test commands will grab a Context object automatically
    • console() renamed to console_thread() for consistency with bot_thread()
    • Many global statements have been removed, various variables moved into separate cogs or classes where relevant
    • Cogs have been moved into separate files, located in cogs/ (vMB #72)
      • common.py created in this directory to house methods and configuration options shared between cogs
        • Functions moved into this module include: is_command_enabled(), command_aliases(), embedq(), timestamp_from_seconds(), prompt_for_choice()
          • embedq() no longer uses *args, now has proper keyword arguments — title (str; main, largest text), subtext (str; shown below title in smaller font), and color (int)
      • General cog moved into cog_general.py
      • Voice cog moved into cog_voice.py, along with most functions and classes related to voice connection and audio playback (vMB #76); other changes have been made within this file, such as...
        • INACTIVITY_TIMEOUT renamed to INACTIVITY_TIMEOUT_MINS
        • play_item() moved here and renamed to make_and_start_player()
        • advance_queue() moved here
        • New function handle_player_stop() created which is used as voice_client.play()'s after callback instead of going straight to advance_queue()
        • QueueItem's class method generate_from_list() renamed to from_list()
        • MediaQueue no longer keeps track of multiple queues per Discord server and instead represents just a single queue (part of vMB #52)
          • It also now contains things like now_playing, last_played, is_looping (formerly loop_this), etc.
  • utils/ directory added to contain helper modules
    • updater.py moved to this directory
      • Release class created to organize response information and easily check versions
      • get_latest_tag() renamed to get_latest_release()
    • miscutil.py created in this directory to house general-purpose utility methods that should be shared between modules
    • configuration.py created in this directory to reduce the amount of duplicated code regarding configuration across this project
      • This module has a get() function that automatically retrieves the default value if none is set in the custom configuration, this removes the need for every single file to have the key typed out twice, e.g. config.get('allow-spotify-playlists', config_default['allow-spotify-playlists']), and can now just be config.get('allow-spotify-playlists')
      • Now contains variables set and typed from every relevant configuration key, which other modules should use by importing the entire module
    • spoofy.py renamed to media.py, moved to this directory (vMB #42)
    • Changes in media.py:
      • The client_id and client_secret supplied to the Spotify API are now just the string literals 'none', turns out it doesn't actually need to be valid to access what the bot was accessing
      • FORCE_NO_MATCH renamed to FORCE_MATCH_PROMPT
      • DURATION_LIMIT renamed to DURATION_LIMIT_SECONDS
      • Removed get_uri(), normal URLs work in all Spotipy functions being used so there was no need for this
      • MediaInfo class added to standardize expected results and improve typing (vMB #67)
        • This class largely just acts as a category for three sub-classes: TrackInfo, AlbumInfo, and PlaylistInfo
      • pytube_track_data() and trim_track_data() removed, made unnecessary by the addition of MediaInfo
      • MediaError class extending from Exception added as a container for media-specific errors; it contains the following sub-classes:
        • MediaFormattingError - an exception used for incorrect or unexpected MediaInfo formatting
        • LocalFileError - raised when attempting to instance TrackInfo with a local / user-uploaded file on a service like Spotify
      • search_ytmusic() renamed to match_ytmusic_track()
        • All arguments have been replaced with a single src_info argument, which takes a TrackInfo object
      • search_ytmusic_album() renamed to match_ytmusic_album()
        • Arguments also replaced with src_info argument, which takes an AlbumInfo object
      • spotify_track(), spotify_album(), and spotify_playlist() all removed, replaced by a from_spotify_url() class method for each applicable MediaInfo sub-class
      • spyt() removed, now unnecessary
    • palette.py moved to this directory
      • file attribute removed from Palette as individual modules no longer get their own color (see below at Other -> Config changes)
      • module attribute added to Palette, represents the color of any module filenames in logs

Features

  • A "roulette mode" has been added, which if enabled with the -roulette command (which will flip the switch by default, or you can explicitly use -roulette on or -roulette off) will choose a random song to play from the current queue each time a song finishes, rather than going in order like normal
  • -history command added which will show previously played tracks, up to the amount set by the new play-history-max config key (see Other below) (#1, partial)
    • In a future release, you'll optionally be able to store this history locally and get stats like most played tracks
  • "Now playing" messages will now show the track's thumbnail in its embed (vMB #70)
  • Multiple messages are prefixed with relevant emoji to act as status icons
  • -faq command added to get the bot's FAQ page
  • -issues command added to the get the bot's issues page
  • User configuration will now be checked and validation on startup, to catch surface-level issues and warn of them or exit the script if it would not be able to continue
  • The bot now shows "Listening to [song title]" as its user status

Fixes

  • Using the stop console command will now suppress the resulting CancelledError
  • Properly fixed an issue with 404 errors when trying to edit or delete bot messages

Other

  • -analyze command removed
  • spotify_config.json no longer needed
  • Config changes:
    • Default value of use-top-match set to no
    • Default value of command-blacklist now set to test alone
    • Default aliases for join, loop, and move removed
    • force-no-match renamed to force-match-prompt for clarity
    • spotify-playlist-limit removed, playlist-track-limit and album-track-limit added in its place (limit applies to any source now)
    • use-url-cache removed
    • clearcache entry in aliases removed
    • play-history-max (int) has been added
    • In logging-options:
      • show-console-logs, show-verbose-logs, and ignore-logs-from have all been removed
      • console-log-level (boolean) has been added
      • log-full-tracebacks (boolean) has been added
      • colors:
        • The color entries for filenames like bot-py have been removed, module added in their place, all files/modules will be shown as the same color if colored console logs are enabled
  • Changes in requirements.txt:
+   ADDED: colorlog        == 6.8.2*
+ UPDATED: aioconsole      == 0.7.1
+ UPDATED: discord.py      == 2.4.0
+ UPDATED: python-benedict == 0.33.2
+ UPDATED: requests        == 2.32.2
+ UPDATED: spotipy         == 2.24.0
+ UPDATED: yt_dlp          == 2024.7.2
+ UPDATED: ytmusicapi      == 1.7.4
- REMOVED: regex

*The version requirement for colorlog is actually my fork of the module, which just allows for directly using escape codes and not only relying on color name strings, so that how colors were handled previously in logs can be compatible.

Pre-releases

2.0.0-pre.3

  • Fixed the updater script
  • Fixed the Spotify setup script

2.0.0-pre.2

  • Fixed help command failing when not connected to ...
Read more