Skip to content

Conversation

@ahson01
Copy link

@ahson01 ahson01 commented Sep 29, 2025

This PR extends JMusicBot with optional YouTube OAuth2 login, a transformable source mechanism, and additional audio source managers. It also updates dependencies and documents the fork-specific changes.

Key Changes

  • YouTube OAuth2 integration
    • Toggle via youtubeoauth2 in config.txt.
    • Captures OAuth flow from logs and persists refresh token to youtubetoken.txt.
    • Uses stored token to authorise the YouTube source on startup.
  • Transformative sources
    • New transforms section in config to rewrite inputs into playable sources.
    • TransformativeAudioSourceManager loads transformed inputs using selectors and formatting.
  • Expanded audio sources
    • Registers DuncteBot source managers and several additional lavaplayer managers.
  • Config/UI/Boot wiring
    • BotConfig loads youtubeoauth2 and transforms.
    • Bot wires a YoutubeOauth2TokenHandler into logback to intercept OAuth messages.
    • reference.conf documents new options and defaults.
  • Documentation
    • README.md updated with fork notice and OAuth instructions.

Files Touched

  • Config and startup
    • src/main/java/com/jagrosh/jmusicbot/BotConfig.java: load youtubeoauth2 and transforms.
    • src/main/java/com/jagrosh/jmusicbot/Bot.java: initialize YoutubeOauth2TokenHandler.
    • src/main/resources/reference.conf: add youtubeoauth2, transforms, and explanatory comments.
  • Audio stack
    • src/main/java/com/jagrosh/jmusicbot/audio/PlayerManager.java: register transforms, YouTube OAuth2, and new source managers.
    • src/main/java/com/jagrosh/jmusicbot/audio/TransformativeAudioSourceManager.java: new manager for input rewrites.
    • src/main/java/com/jagrosh/jmusicbot/utils/YoutubeOauth2TokenHandler.java: logback TurboFilter to handle OAuth flow and token persistence.
  • Docs and build
    • README.md: fork/OAuth notes.
    • pom.xml: dependency updates and repositories.

Configuration

  • New/updated properties in config.txt:
    • youtubeoauth2 (boolean, default false)
    • transforms (object, default {})

Dependency Updates

  • JDA: 5.6.1
  • lavaplayer: 2.2.4
  • dev.lavalink.youtube:common: 1.13.5
  • com.dunctebot:sourcemanagers: 1.9.0 (excludes legacy YouTube artifacts)
  • com.github.jagrosh:JLyrics: master-SNAPSHOT
  • Adds necessary repositories (dv8tion, jitpack, lavalink, etc.).

Checklist

  • Compiles locally and via CI
  • Backwards compatible defaults
  • Docs updated (README.md, reference.conf)
  • No breaking API changes for commands

.enableCache(CacheFlag.MEMBER_OVERRIDES, CacheFlag.VOICE_STATE)
.disableCache(CacheFlag.ACTIVITY, CacheFlag.CLIENT_STATUS, CacheFlag.EMOTE, CacheFlag.ONLINE_STATUS)
.enableCache(CacheFlag.VOICE_STATE)
.disableCache(CacheFlag.ACTIVITY, CacheFlag.EMOJI, CacheFlag.ONLINE_STATUS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDA 5 requires intents to be explicitly enabled
Thus you are missing, otherwise you will not be able to read any content or members
.enableIntents(GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS)

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.

2 participants