Skip to content

Rework guild-join onboarding message to lead with moderation value and fix delivery gaps - #278

Merged
LightSage merged 1 commit into
masterfrom
copilot/improve-onboarding-process
Aug 27, 2026
Merged

Rework guild-join onboarding message to lead with moderation value and fix delivery gaps#278
LightSage merged 1 commit into
masterfrom
copilot/improve-onboarding-process

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

The existing on_lightning_guild_add onboarding message led with prefix mechanics instead of moderation value, pointed only to external docs instead of an actionable next step, and was silently dropped if the server had no usable system_channel/public_updates_channel.

Message copy

  • Lead with the moderation pitch (raid/spam protection, mod logs) instead of prefix setup instructions.
  • Point directly to the existing in-bot guided flow — /automod rules interactive and /modlog — instead of only linking to documentation.
  • Added an "AutoMod Quick Start" button alongside the general docs link.

Delivery reliability

  • attempt_onboarding_send tries system_channel then public_updates_channel, same as before, but now falls back to attempt_onboarding_dm (DMs the guild owner, fetching via API if not cached) when no channel is available or sendable.
  • record_onboarding_delivery writes a channel/dm/failed status to Redis (lightning:onboarding-sent:{guild_id}, 30-day TTL) so delivery gaps are observable instead of failing silently.
if not await self.attempt_onboarding_send(guild, msg, view):
    status = "dm" if await self.attempt_onboarding_dm(guild, msg, view) else "failed"
else:
    status = "channel"

await self.record_onboarding_delivery(guild, status)

Summary by Sourcery

Improve guild onboarding by emphasizing moderation value, providing guided setup actions, and making message delivery observable and resilient.

New Features:

  • Add actionable AutoMod and moderation setup guidance to the guild onboarding message, including an AutoMod Quick Start link.
  • Fall back to messaging the guild owner by DM when no suitable server channel is available.

Bug Fixes:

  • Prevent onboarding messages from being silently dropped when channel delivery is unavailable or fails.
  • Fetch uncached guild owners and handle delivery failures while logging useful warnings.

Enhancements:

  • Record channel, DM, or failed onboarding delivery status in Redis with a 30-day expiry for observability.

Co-authored-by: LightSage <46062298+LightSage@users.noreply.github.com>
@sourcery-ai

sourcery-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

Reworks guild onboarding to prioritize moderation setup, adds actionable in-bot guidance and a quick-start link, and prevents silent delivery gaps through owner-DM fallback plus Redis delivery-status tracking.

Sequence diagram for reliable guild onboarding delivery

sequenceDiagram
    participant Discord as Discord
    participant Bot as BotMeta
    participant Owner as GuildOwner
    participant Redis as Redis

    Discord->>Bot: on_lightning_guild_add(guild)
    Bot->>Bot: attempt_onboarding_send(guild, msg, view)
    alt Sendable system or public updates channel
        Bot->>Discord: channel.send(msg, view)
        Discord-->>Bot: success
        Bot->>Bot: record_onboarding_delivery(guild, channel)
        Bot->>Redis: set(lightning:onboarding-sent:guild_id, channel, 30 days)
    else No channel or channel send fails
        Bot->>Bot: attempt_onboarding_dm(guild, msg, view)
        alt Cached owner unavailable
            Bot->>Discord: fetch_user(guild.owner_id)
            Discord-->>Bot: owner
        end
        Bot->>Owner: send(preamble + msg, view)
        alt DM succeeds
            Bot->>Bot: record_onboarding_delivery(guild, dm)
            Bot->>Redis: set(lightning:onboarding-sent:guild_id, dm, 30 days)
        else DM fails or owner unavailable
            Bot->>Bot: record_onboarding_delivery(guild, failed)
            Bot->>Redis: set(lightning:onboarding-sent:guild_id, failed, 30 days)
        end
    end
Loading

File-Level Changes

Change Details Files
Reframe onboarding copy around moderation value and actionable setup paths.
  • Lead with raid, spam, rule-breaker protection and moderation logs.
  • Direct admins to /automod rules interactive and /modlog.
  • Replace the prior AutoMod link with an AutoMod Quick Start button alongside general documentation.
lightning/cogs/info/bot_meta.py
Add resilient channel-to-owner-DM delivery with explicit failure handling.
  • Try system and public updates channels while handling send failures.
  • DM the guild owner when no usable channel remains, fetching an uncached owner when needed.
  • Log undeliverable channel and DM attempts.
lightning/cogs/info/bot_meta.py
Persist onboarding delivery outcomes for observability.
  • Record channel, dm, or failed status in Redis under the guild-specific key.
  • Apply a 30-day expiration and tolerate Redis recording failures with a warning.
lightning/cogs/info/bot_meta.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@LightSage
LightSage marked this pull request as ready for review August 27, 2026 01:31

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the new onboarding content, channel selection, or owner-DM fallback is wrong, a message may already have been delivered to guild members or an owner when the change is reverted; reverting cannot unsend it. The impact is bounded to onboarding notifications, with delivery status retained only in Redis for up to 30 days.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@LightSage
LightSage merged commit 1fe6600 into master Aug 27, 2026
4 checks passed
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