Skip to content

Commit

Permalink
Merge pull request #3356 from modmail-dev/development
Browse files Browse the repository at this point in the history
Merge Development
  • Loading branch information
Taaku18 authored Jan 16, 2025
2 parents bb2892f + 57ac0f1 commit c883b76
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/modmail-dev/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.

# v4.1.1

### Fixed
- `?msglink` now supports threads with multiple recipients. ([PR #3341](https://github.com/modmail-dev/Modmail/pull/3341))
- Fixed persistent notes not working due to discord.py internal change. ([PR #3324](https://github.com/modmail-dev/Modmail/pull/3324))

### Added
- Support for custom activities with `?activity custom <text>` ([PR #3352](https://github.com/modmail-dev/Modmail/pull/3352))

# v4.1.0

Drops support for Python 3.9. Python 3.10 and Python 3.11 are now the only supported versions.
Expand All @@ -14,7 +23,7 @@ Drops support for Python 3.9. Python 3.10 and Python 3.11 are now the only suppo
- GIF stickers no longer cause the bot to crash.
- `?alias make/create` as aliases to `?alias add`. This improves continuity between the bot and its command structure. ([PR #3195](https://github.com/kyb3r/modmail/pull/3195))
- Loading the blocked list with the `?blocked` command takes a long time when the list is large. ([PR #3242](https://github.com/kyb3r/modmail/pull/3242))
- Reply not being forwarded from DM. (PR [#3239](https://github.com/modmail-dev/modmail/pull/3239))
- Reply not being forwarded from DM. ([PR #3239](https://github.com/modmail-dev/modmail/pull/3239))
- Cleanup imports after removing/unloading a plugin. ([PR #3226](https://github.com/modmail-dev/Modmail/pull/3226))
- Fixed a syntactic error in the close message when a thread is closed after a certain duration. ([PR #3233](https://github.com/modmail-dev/Modmail/pull/3233))
- Removed an extra space in the help command title when the command has no parameters. ([PR #3271](https://github.com/modmail-dev/Modmail/pull/3271))
Expand Down
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "4.1.0"
__version__ = "4.1.1"


import asyncio
Expand Down
12 changes: 9 additions & 3 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,15 @@ async def sfw(self, ctx):
@checks.thread_only()
async def msglink(self, ctx, message_id: int):
"""Retrieves the link to a message in the current thread."""
try:
message = await ctx.thread.recipient.fetch_message(message_id)
except discord.NotFound:
found = False
for recipient in ctx.thread.recipients:
try:
message = await recipient.fetch_message(message_id)
found = True
break
except discord.NotFound:
continue
if not found:
embed = discord.Embed(
color=self.bot.error_color, description="Message not found or no longer exists."
)
Expand Down
20 changes: 15 additions & 5 deletions cogs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
import sys
import typing
import zipfile
from importlib import invalidate_caches
from difflib import get_close_matches
from importlib import invalidate_caches
from pathlib import Path, PurePath
from re import match
from site import USER_SITE
from subprocess import PIPE

import discord
from discord.ext import commands

from packaging.version import Version

from core import checks
from core.models import PermissionLevel, getLogger
from core.paginator import EmbedPaginatorSession
from core.utils import truncate, trigger_typing
from core.utils import trigger_typing, truncate

logger = getLogger(__name__)

Expand Down Expand Up @@ -132,8 +131,11 @@ async def cog_load(self):

async def populate_registry(self):
url = "https://raw.githubusercontent.com/modmail-dev/modmail/master/plugins/registry.json"
async with self.bot.session.get(url) as resp:
self.registry = json.loads(await resp.text())
try:
async with self.bot.session.get(url) as resp:
self.registry = json.loads(await resp.text())
except asyncio.TimeoutError:
logger.warning("Failed to fetch registry. Loading with empty registry")

async def initial_load_plugins(self):
for plugin_name in list(self.bot.config["plugins"]):
Expand Down Expand Up @@ -638,6 +640,14 @@ async def plugins_registry(self, ctx, *, plugin_name: typing.Union[int, str] = N

registry = sorted(self.registry.items(), key=lambda elem: elem[0])

if not registry:
embed = discord.Embed(
color=self.bot.error_color,
description="Registry is empty. This could be because it failed to load.",
)
await ctx.send(embed=embed)
return

if isinstance(plugin_name, int):
index = plugin_name - 1
if index < 0:
Expand Down
8 changes: 7 additions & 1 deletion cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
- `listening`
- `watching`
- `competing`
- `custom`
When activity type is set to `listening`,
it must be followed by a "to": "listening to..."
Expand All @@ -510,6 +511,9 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
the linked twitch page:
- `{prefix}config set twitch_url https://www.twitch.tv/somechannel/`
When activity type is set to `custom`, you can set
any custom text as the activity message.
To remove the current activity status:
- `{prefix}activity clear`
"""
Expand Down Expand Up @@ -609,7 +613,9 @@ async def set_presence(self, *, status=None, activity_type=None, activity_messag
elif activity_type == ActivityType.streaming:
url = self.bot.config["twitch_url"]

if activity_type is not None:
if activity_type == ActivityType.custom:
activity = discord.CustomActivity(name=activity_message)
elif activity_type is not None:
activity = discord.Activity(type=activity_type, name=activity_message, url=url)
else:
activity = None
Expand Down
2 changes: 1 addition & 1 deletion core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ async def send_persistent_notes():
ids = {}

class State:
def store_user(self, user):
def store_user(self, user, cache):
return user

for note in notes:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extend-exclude = '''

[tool.poetry]
name = 'Modmail'
version = '4.1.0'
version = '4.1.1'
description = "Modmail is similar to Reddit's Modmail, both in functionality and purpose. It serves as a shared inbox for server staff to communicate with their users in a seamless way."
license = 'AGPL-3.0-only'
authors = [
Expand Down

0 comments on commit c883b76

Please sign in to comment.