Skip to content

Feature/upstream 4.2 merge#9

Open
khakers wants to merge 18 commits into
developfrom
feature/upstream-4.2-merge
Open

Feature/upstream 4.2 merge#9
khakers wants to merge 18 commits into
developfrom
feature/upstream-4.2-merge

Conversation

@khakers
Copy link
Copy Markdown
Owner

@khakers khakers commented Feb 16, 2026

Merges new upstream modmail changes
These were merged into modmail as mostly 2 large commits and thus largely unreviewable when cherry picking

Issue list:

  • Double logging (1 is writing to console with the wrong format)
  • snooze query specificity
  • snooze data type refactor
  • a number of errors and exceptions are logged at the debug or info level
  • Save forwarded message data in mongoDB

Taaku18 and others added 12 commits February 15, 2026 17:57
* Add (truncated) preview to snippets command (modmail-dev#3342)

* Add (truncated) preview to snippets command

* Add old view as option with "compact"

* Fix black formatting

* Fix: Image url regex in thread send method (modmail-dev#3378)

* feat minimum character requirement for thread creation. (modmail-dev#3380)

* update: dpy, snoozing.

This pull request updated discord.py to 2.5.2.

This also brings a new few features.
- snooze
- snoozed
- unsnooze
- clearsnoozed

Aswell as a few new config options.
- max_snooze_time
- snooze_title
- snooze_text
- unsnooze_tex
- unsnooze_notify_channel

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* remove: unneeded import

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Formatting black

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix?: internal messages on restoration

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* formatting

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: internal messages.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: internals

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: use same logkey after restoration

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Add files via upload

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: show who send which internal message.

* Black formatting.

* Update Pipfile

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update Pipfile.lock

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: unsnooze bug

* feat: CV2

* update: black

* fix: duplicates in logs, notes.

* feat: dpy 2.6.3, forwarded messages, bug fixes.

* Fix jump_url not being displayed

* Update pipfile for new dpy version

* fix: bug in note title/color

* Update snooze arg

* Update Pipfile to include tomli package

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* auto detect dpy version

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Remove crlf terminators

* fix: ignore typing failures (modmail-dev#3389)

* fix: ignore typing failures

Make Modmail keep working when typing is disabled/outage

* fix: only surpress failures

* chore: sync local edits before push

* Lock pipenv

* Fix: closing with timed words/ command in reply. (modmail-dev#3391)

* fix: ignore typing failures

Make Modmail keep working when typing is disabled/outage

* fix: only surpress failures

* chore: sync local edits before push

* Fix: closing with timed words/ command in reply.

* Fix: typing in changelog command.

* Fix: closing with timed words (additional))

* Fix changelog entry for command reply issue

Corrected wording in the changelog entry regarding command inclusion in replies.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update CHANGELOG for v4.2.0 enhancements

Forwarded messages now display correctly in threads.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

---------

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Remove disutil, undo lowercasing escape seq

* Add back uvloop

* Add config help for snooze configs

Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

* Update sponsors and bmac links

---------

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>
Co-authored-by: Sebastian <61157793+sebkuip@users.noreply.github.com>
Co-authored-by: Zallom <Yg75nWkHX7jBHcqRPUbb783c54xSa9+github63384893@gmail.com>
Co-authored-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
Co-authored-by: “lorenzo132” <lhoorn4@gmail.com>
Co-authored-by: Martin <box152535@gmail.com>

(cherry picked from commit 21f4766)
The logs command can be used anywhere again.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
(cherry picked from commit 829a364)
* Add (truncated) preview to snippets command (modmail-dev#3342)

* Add (truncated) preview to snippets command

* Add old view as option with "compact"

* Fix black formatting

* Fix: Image url regex in thread send method (modmail-dev#3378)

* feat minimum character requirement for thread creation. (modmail-dev#3380)

* update: dpy, snoozing.

This pull request updated discord.py to 2.5.2.

This also brings a new few features.
- snooze
- snoozed
- unsnooze
- clearsnoozed

Aswell as a few new config options.
- max_snooze_time
- snooze_title
- snooze_text
- unsnooze_tex
- unsnooze_notify_channel

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* remove: unneeded import

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Formatting black

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix?: internal messages on restoration

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* formatting

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: internal messages.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: internals

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: use same logkey after restoration

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Add files via upload

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update thread.py

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: show who send which internal message.

* Black formatting.

* Update Pipfile

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update Pipfile.lock

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* fix: unsnooze bug

* feat: CV2

* update: black

* fix: duplicates in logs, notes.

* feat: dpy 2.6.3, forwarded messages, bug fixes.

* Fix jump_url not being displayed

* Update pipfile for new dpy version

* fix: bug in note title/color

* Update snooze arg

* Update Pipfile to include tomli package

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* auto detect dpy version

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Remove crlf terminators

* fix: ignore typing failures

Make Modmail keep working when typing is disabled/outage

* fix: only surpress failures

* chore: sync local edits before push

* fix: ignore typing failures (modmail-dev#3389)

* fix: ignore typing failures

Make Modmail keep working when typing is disabled/outage

* fix: only surpress failures

* chore: sync local edits before push

* Lock pipenv

* Fix: closing with timed words/ command in reply.

* Fix: typing in changelog command.

* Fix: closing with timed words (additional))

* Fix changelog entry for command reply issue

Corrected wording in the changelog entry regarding command inclusion in replies.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update CHANGELOG for v4.2.0 enhancements

Forwarded messages now display correctly in threads.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Fix: closing with timed words/ command in reply. (modmail-dev#3391)

* fix: ignore typing failures

Make Modmail keep working when typing is disabled/outage

* fix: only surpress failures

* chore: sync local edits before push

* Fix: closing with timed words/ command in reply.

* Fix: typing in changelog command.

* Fix: closing with timed words (additional))

* Fix changelog entry for command reply issue

Corrected wording in the changelog entry regarding command inclusion in replies.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Update CHANGELOG for v4.2.0 enhancements

Forwarded messages now display correctly in threads.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

---------

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Remove disutil, undo lowercasing escape seq

* Add back uvloop

* Add config help for snooze configs

Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

* fix; raceconditions, thread duplication on unsnooze, message queue for accurasy on high load

* Update package versions in requirements.txt

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* snooze(move): auto-unsnooze on reply/any mod message; enforce hidden permissions on auto-created Snoozed Threads and sync perms on move; restore original overwrites on unsnooze; add capacity guard and config docs

* unsnooze: suppress mentions during restore (AllowedMentions.none on replay and notifications)

* Remove base64 snooze/unsnooze logic, fix notification crash, clean up replay logic

* fix: escape mentions on unsnooze

* Fix: Only create log URL button if valid, and robust channel restore for snooze

* black formatting

* Unsnooze: prefix username (user_id) for plain-text replay messages

* feat: command queue during unsnooze process.

feat(config): `unsnooze_history_limit`: Limits the number of messages replayed when unsnoozing (genesis message and notes are always shown).

* fix: contact while snooze returned as invalid channel

* Update thread.py

* fix: snooze timing

* change: rename default snooze time config

* fix: parsing

* fix: cache for snooze timer

* fix: Properly accessing nested data

* rename: default_snooze_time -> snooze_default_duration

* improve unsnooze notify

* fix: id extraction for clean database.

* improve: support for user-friendly time input for snooze_default_duration

* reflect config help snooze_default_duration for userfriendly time

* fix: anonreply showing None

This fixes a bug where, if no `anon_username` is set and the moderator has no roles, the `anon_username` is not showing as `None` anymore, and will show as intended.

The logic now works as follows:
- If a config anon_username is set → use it
- Else, if a mod_tag is set → use it
- Else, if the moderator has a top role → use that
- Else → use "Anonymous"

* black formatting

* feat: thread creation menu

Credits to Sebkuip(https://github.com/sebkuip) for the original idea and populair plugin.(advanced-menu)

This now is a core feature.

* Update requirements.txt

* fixes

This solves:
- `config get`: invalid form body
- restores functionality after menu timeout.

* feat: thread_creation_menu_precreate_channel

adds a new: thread_creation_menu_precreate_channel

to create the threads, even when nothing is selected yet.

* core

Fully merged `threadmenu config` into the main bot’s config system.

Added threadmenu embed customization capability.

* Change thread_creation_menu config

Moves thread_creation_menu_options, thread_creation_menu_submenus and thread_creation_menu_enabled to the private config keys to avoid changes via ?config set as they can be changed via ?threadmenu

* Change Option Description/Emoji

Changes the description and emoji making it possible to be None (optional)

* fix: disable menu after closure

* feats/fixes

configs added:
thread_creation_send_dm_embed

fix:
snooze while no option was selected, after snoozing selecting option first errored. This is now solved

* forgot to add help

* rely on config for precreating. fix error with unknown channels

* feat: large images in threadmenu embed

* feat: threadmenu reset

* cleanup

* codereviews response. Formatting (ruff)

* log instead of pass on exception

* format

* higher delays

* black formatting, smoothen menu closure

* smoothen which selecetion was made

* solves the command from showing in the replies in rare cases

* Update CHANGELOG.md

* Update sponsors and bmac links

* fix: typeerror

* fix: Remove thread-only restriction from logs command

The logs command can be used anywhere again.

* Remove commands from being saved in DB.

* fix: correct guildpfp with sepserver setup - made by martin

This PR fixes displaying the wrong guild icon in the thread_creation_response embed.
When servers having a seperate server setup, the guild icon from the main guild should be displayed instead of the inbox guild.

* fix: robust channel deletion handling, skip audit log attribution if permission is missing

* update: use current reqs.txt as masterbranch

* sync: pip&pip lock with master

* Patch Thread Menu Editing Crash

* bump version

* Missing a newline

Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

* Missing a newline

Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>

---------

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
Signed-off-by: Taku <45324516+Taaku18@users.noreply.github.com>
Co-authored-by: Sebastian <61157793+sebkuip@users.noreply.github.com>
Co-authored-by: Zallom <Yg75nWkHX7jBHcqRPUbb783c54xSa9+github63384893@gmail.com>
Co-authored-by: Martin <box152535@gmail.com>
Co-authored-by: Taku <45324516+Taaku18@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

(cherry picked from commit 124669d)
This adds two commands for renaming snippets and aliases for easier name editing.
* Updates Plugin Wiki Link

As the github repo wiki got moved to the own docs page this link needs to be updated.
I will update it accordingly if docs may change later.

* Fix @local/name doc

* Chnaged Plugin Help Link for modmail-dev#3322

Plugin Help link got moved again into a new page of the docs.

---------

Co-authored-by: Sebastian <61157793+sebkuip@users.noreply.github.com>
…dmail-dev#3404)

* Threadmenu now supports submenus

* Fix a small issue with path not resetting after main menu.

* Fix copilot suggestions

* Black formatting

* Fix undeclared vars

* threadmenu: submenu navigation fixes

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* threadmenu: submenu navigation fixes

Refactor thread creation menu handling to improve path management and submenu navigation.

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>

* Fix formatting according to black

---------

Signed-off-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
Co-authored-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
…-dev#3412)

* improvements changelog.md

* remove advancedmenu plugin

* fix: hide privatekey from changelog

This is for internal use only.

* black formatting

* feat: dispatch event for snoozing/unsnoozing.

This allows plugin developers to create feature on snoozing/unsnoozing.

* bump pipfile

* Update Pipfile.lock

* black formatting

* sync with pipfile.

---------

Co-authored-by: Sebastian <61157793+sebkuip@users.noreply.github.com>
* Add threadmenu toggle notice

Adds a notice to the `threadmenu toggle` command. It gets displayed if the advancedmenu plugin is part of the bot and checks if its enabled at the same time. useful for users because both would interrupt eachother.

* Threadmenu toggle notice link

Adds a link to the migration guide for the legacy plugin.
* Fixes thread_auto_close execution when disabled.

This fixes the issue modmail-dev#3290 which caused threads to be auto-closed even if `thread_auto_close` has been disabled.

There was also an issue that closed the thread when the user has responded to mods. The thread should stay open and only auto close when the staff has replied back.

* fix: prevent autoclosing when close has been cancelled.

This solves the thread from autoclosing if the closure has been cancelled earlier in a thread.

* fix: AttributeError / lower mongo calls.

I had added a small bugfix aswell for pagination when an invalid config var was given.

This happened to occur upon removing the `thread_auto_close` config.

---------

Co-authored-by: lorenzo132 <lhoorn4@gmail.com>
Co-authored-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
* support to edit and delete plain reply messages

* fix linting

* fix: not rely on mod_color as originally was made.

This will avoid crashes when the mod_color get changed.

* fix: typeerror / refactor

* fix linting

* silent unneeded noise
@khakers
Copy link
Copy Markdown
Owner Author

khakers commented Feb 16, 2026

Appears to be a double logging issue present right now

@khakers
Copy link
Copy Markdown
Owner Author

khakers commented Feb 16, 2026

Found problems in the snooze implementation from modmail
working on:

  • Fix snooze query specificity (they currently select the first thread in the database for a given user)
  • Use mongodb timestamps instead of strings
  • send user thread messages with a webhook instead of the current simple message format so they appear to have come from that user.

@khakers
Copy link
Copy Markdown
Owner Author

khakers commented Mar 16, 2026

Double logging issue has been fix, it was due to all the snooze code using logging.<level> instead of logger.<level>.

Improves type hints
Fix insufficiently specific databse queries updating incorrect entries
use mongodb timestamps instead of strings
Fix logging issues
use webhooks to send messages so they appear to come from the user that
originally sent them
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR merges upstream Modmail 4.2 changes into the fork, incorporating upstream fixes (logging/typing/forwarded messages) and introducing new user-facing features (snoozing and thread-creation menu) along with dependency/version updates.

Changes:

  • Bump project version to 5.0.0-alpha.1, update core dependencies (notably discord-py and aiohttp), and adjust licensing/lockfile.
  • Add/extend Modmail features: snooze/unsnooze flows, thread minimum character enforcement, forwarded-message extraction/relay, and a new core threadmenu cog/config.
  • Improve operational behavior: “safe typing” wrapper, logging formatter tweaks, pagination lifecycle changes, and various embed/icon_url robustness updates.

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Version bump, dependency updates, license field adjustments.
pdm.lock Lockfile regenerated to reflect updated dependencies and new packages.
core/utils.py Adds safe_typing, forwarded-content extraction helpers, button custom_id changes.
core/time.py Tweaks time parsing heuristics and punctuation handling for more user-friendly parsing.
core/paginator.py Makes paginator non-blocking by waiting/closing in a background task; refactors stop button setup.
core/models.py Logging formatting updates; disables discord logger propagation to avoid double-logging.
core/config_help.json Documents new config options (thread menu, snooze, min characters).
core/config.py Adds new config defaults and conversion rules (duration seconds, channel/category parsing).
core/clients.py Type annotations and small robustness tweaks for avatar URL fields; formatting changes.
core/changelog.py Makes avatar URL usage safer when generating embeds.
core/_color_data.py Removes stray whitespace.
cogs/utility.py Various embed formatting changes; config listing pagination; alias safety checks; new alias/snippet rename commands.
cogs/threadmenu.py New cog implementing core thread-creation menu configuration commands.
cogs/plugins.py Uses safe_typing, updates docs link, and formatting improvements.
cogs/modmail.py Large snooze/unsnooze feature addition and behavior changes.
bot.py Version update; DM message ordering queue; forwarded-message handling; additional snooze behaviors; internal logging changes.
CHANGELOG.md Documents new snooze + threadmenu capabilities and several upstream fixes.
.github/FUNDING.yml Removes funding configuration.
.gitattributes Adds default text normalization.
.env.example Adds DISABLE_AUTOUPDATES example variable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cogs/modmail.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Merges upstream Modmail 4.2 changes into this fork, including updated dependencies, new/expanded thread workflow features (snooze + thread-creation menu), and multiple robustness improvements around logging, typing indicators, and message handling (including forwarded messages).

Changes:

  • Bump project version/dependencies and adjust packaging metadata (license, new deps, updated lockfile).
  • Add/extend configuration surface and commands for snoozing threads and for an interactive thread-creation menu (new threadmenu cog + new config keys/help text).
  • Improve operational robustness (typing failures tolerated, DM ordering queue, forwarded-message handling, logging format/handlers, paginator non-blocking behavior).

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
pyproject.toml Version bump, dependency updates, add license + lottie dependency.
pdm.lock Lockfile update to match dependency changes.
core/utils.py Add safe typing context manager, forwarded-content extraction helper, UI button API adjustments.
core/time.py Parsing heuristics/formatting tweaks for user-friendly time handling.
core/paginator.py Make paginator non-blocking by backgrounding view wait/close; UI button refactor.
core/models.py Logging formatter updates, handler config tweaks (incl. propagate=False).
core/config_help.json Document new config options (thread menu, snooze, min characters, etc.).
core/config.py Add new config defaults/typing (colors/booleans/duration parsing); config parsing tweaks.
core/clients.py Persist additional forwarded message metadata into Mongo logs; typing hints.
core/changelog.py Guard avatar URL usage when building changelog embeds.
core/_color_data.py Minor formatting cleanup.
cogs/utility.py Help/config UX adjustments; paginator usage updates; misc formatting changes.
cogs/threadmenu.py New core cog implementing thread menu configuration commands & import/export.
cogs/plugins.py Update docs link, safer typing usage, misc formatting changes.
cogs/modmail.py Major feature additions/changes (snooze commands, snippet UX updates, typing safety changes).
bot.py Version bump, add DM processing queue, forwarded-message handling, autoupdate/metadata tasks, various robustness tweaks.
CHANGELOG.md Document new features/config options and fixes.
.github/FUNDING.yml Remove funding config.
.gitattributes Add default text normalization rule.
.env.example Add DISABLE_AUTOUPDATES example env var.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bot.py Outdated
Comment thread core/config.py Outdated
Comment thread cogs/modmail.py
Comment thread cogs/threadmenu.py
return await ctx.send("There are no options in the main menu.")
embed = discord.Embed(title="Main menu", color=discord.Color.blurple())
for v in conf["options"].values():
embed.add_field(name=v["label"], value=v["description"], inline=False)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

threadmenu_show/threadmenu_option_show pass v["description"] and v["emoji"] directly to Embed.add_field. These are optional in the wizard (can be None), but add_field expects strings and will raise if given None. Please coerce missing values to a safe default (e.g. empty string or "(none)") before adding fields.

Suggested change
embed.add_field(name=v["label"], value=v["description"], inline=False)
description = v.get("description")
if description is None:
description = "(none)"
embed.add_field(name=v["label"], value=description, inline=False)

Copilot uses AI. Check for mistakes.
Comment thread cogs/threadmenu.py
and m.content.lower()
in [
"command",
"submenu",
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The typecheck predicate only allows "command"/"submenu", but later code checks for type_ == "cancel". As-is, users cannot cancel at this prompt (their "cancel" message will never pass the wait_for check). Please either include "cancel" in the allowed inputs or add a timeout and a separate cancellation handling path.

Suggested change
"submenu",
"submenu",
"cancel",

Copilot uses AI. Check for mistakes.
Comment thread core/clients.py
Comment on lines +707 to +733
"messageReference": {
"message_id": message.reference.message_id,
"channel_id": message.reference.channel_id,
"guild_id": message.reference.guild_id,
"type": message.reference.type.name,
} if message.reference else None,
"messageSnapshots": [
{
"type": m.type.name,
"content": m.content,
"attachments": [
{
"id": a.id,
"filename": a.filename,
# In previous versions this was true for both videos and images
"is_image": a.content_type and a.content_type.startswith("image/"),
"size": a.size,
"url": a.url,
"content_type": a.content_type,
}
for a in m.attachments
],
"timestamp": m.created_at,
"editedTimestamp": m.edited_at,
}
for m in message.message_snapshots
],
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

message.reference.type.name and iterating message.message_snapshots are not guarded. If reference.type is None/missing (or message_snapshots isn’t present on the message object), append_log will raise and break logging for normal messages. Please use getattr/hasattr with safe fallbacks (e.g., getattr(message, "message_snapshots", [])) and defensively handle missing/None reference.type.

Copilot uses AI. Check for mistakes.
Comment thread cogs/modmail.py Outdated
Comment thread cogs/modmail.py
snoozed_threads = await self.bot.api.logs.find(
{
"$or": [
{"snooze_until": {"$gte": now}},
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

auto_unsnooze_task caches only records with snooze_until >= now, so threads that became due while the bot was offline (i.e., snooze_until < now) will never be picked up by this task after restart. Also, this file contains a second auto-unsnooze loop (snooze_auto_unsnooze), meaning two independent unsnooze schedulers can run at once. Please consolidate to a single scheduler and ensure the DB query selects due threads ($lte now) when appropriate.

Suggested change
{"snooze_until": {"$gte": now}},
{"snooze_until": {"$lte": now}},

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Need to do testing for this case

Comment thread cogs/modmail.py Outdated
Comment thread CHANGELOG.md
Comment on lines +29 to +34
Configuration Options:
* `max_snooze_time`: Sets the maximum duration for snooze.
* `snooze_title`: Customizes the title for snooze notifications.
* `snooze_text`: Customizes the text for snooze notifications.
* `unsnooze_text`: Customizes the text for unsnooze notifications.
* `unsnooze_notify_channel`: Specifies the channel for unsnooze notifications.
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

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

The changelog lists a max_snooze_time configuration option, but the config defaults/validation keys added in this PR use snooze_default_duration (and the snooze command currently clamps duration to that default). Please either implement and document max_snooze_time end-to-end, or update the changelog to reflect the actual config keys/behavior.

Copilot uses AI. Check for mistakes.
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.

6 participants