Skip to content

Commit 9556ef7

Browse files
committed
Merge from master
2 parents e585b23 + 986b744 commit 9556ef7

File tree

4 files changed

+34
-23
lines changed

4 files changed

+34
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424

2525
- `thread_auto_close_response` has a configurable variable `{timeout}`.
2626
- `?snippet` is now the default command name instead of `?snippets` (`?snippets` is still usable). This is to make this consistent with `?alias`/`?aliases`.
27-
- Colorama is no longer a necessity, this is due to some unsupported OS.
27+
- `colorama` is no longer a necessity, this is due to some unsupported OS.
28+
- Changelog command can now take a version argument to jump straight to specified version.
2829

2930
### Fixes
3031

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ All threads are logged and you can view previous threads through the correspondi
4848
* Snippets and *command aliases*.
4949
* Minimum duration for accounts to be created before allowed to contact Modmail (`account_age`).
5050
* Minimum duration for member to be in the guild allowed to contact Modmail (`guild_age`).
51-
* **Thread logs:**
51+
* **Advanced Logging Functionality:**
5252
* When you close a thread, a [log link](https://logs.modmail.tk/example) is generated and posted to your log channel.
5353
* Native Discord dark-mode feel.
5454
* Markdown/formatting support.
@@ -108,6 +108,20 @@ Finally, run the bot.
108108
$ pipenv run bot
109109
```
110110

111+
## Sponsors
112+
113+
Special thanks to our sponsors for supporting the project.
114+
115+
- [flyAurora](https://flyaurora.xyz/):
116+
117+
<a href='https://flyaurora.xyz/'>
118+
<img height=150 src='https://pbs.twimg.com/profile_images/1142307497115443200/whbHhb9B_400x400.jpg'>
119+
</a>
120+
<br>
121+
<br>
122+
123+
Become a [sponsor](https://patreon.com/kyber).
124+
111125
## Plugins
112126

113127
Modmail supports the use of third-party plugins to extend or add functionality to the bot. This allows the introduction of niche features as well as anything else outside of the scope of the core functionality of Modmail. A list of third party plugins can be found using the `plugins registry` command. To develop your own, check out the [documentation](https://github.com/kyb3r/modmail/wiki/Plugins) for plugins.

cogs/utility.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,24 @@ def cog_unload(self):
227227
@commands.command()
228228
@checks.has_permissions(PermissionLevel.REGULAR)
229229
@trigger_typing
230-
async def changelog(self, ctx):
230+
async def changelog(self, ctx, version: str.lower = ''):
231231
"""Shows the changelog of the Modmail."""
232232
changelog = await Changelog.from_url(self.bot)
233+
version = version.lstrip("vV") if version else changelog.latest_version.version
234+
235+
try:
236+
index = [v.version for v in changelog.versions].index(version)
237+
except ValueError:
238+
return await ctx.send(
239+
embed=Embed(
240+
color=Color.red(),
241+
description=f"The specified version `{version}` could not be found.",
242+
)
243+
)
244+
233245
try:
234246
paginator = PaginatorSession(ctx, *changelog.embeds)
247+
paginator.current = index
235248
await paginator.run()
236249
except Exception:
237250
await ctx.send(changelog.CHANGELOG_URL)

core/thread.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ async def _close(
320320
else:
321321
message = self.bot.config["thread_close_response"]
322322

323-
message = message.format(closer=closer, loglink=log_url, logkey=log_data["key"])
323+
message = message.format(closer=closer, loglink=log_url, logkey=log_data["key"] if log_data else None)
324324

325325
embed.description = message
326326
footer = self.bot.config["thread_close_footer"]
@@ -763,7 +763,7 @@ async def find(
763763
) -> Thread:
764764
"""Finds a thread from cache or from discord channel topics."""
765765
if recipient is None and channel is not None:
766-
return await self._find_from_channel(channel)
766+
return self._find_from_channel(channel)
767767

768768
thread = None
769769

@@ -789,7 +789,7 @@ async def find(
789789
thread.ready = True
790790
return thread
791791

792-
async def _find_from_channel(self, channel):
792+
def _find_from_channel(self, channel):
793793
"""
794794
Tries to find a thread from a channel channel topic,
795795
if channel topic doesnt exist for some reason, falls back to
@@ -801,23 +801,6 @@ async def _find_from_channel(self, channel):
801801
if channel.topic:
802802
user_id = match_user_id(channel.topic)
803803

804-
# BUG: When discord fails to create channel topic.
805-
# search through message history
806-
elif channel.topic is None:
807-
try:
808-
async for message in channel.history(limit=100):
809-
if message.author != self.bot.user:
810-
continue
811-
if message.embeds:
812-
embed = message.embeds[0]
813-
if embed.footer.text:
814-
user_id = match_user_id(embed.footer.text)
815-
if user_id != -1:
816-
break
817-
except discord.NotFound:
818-
# When the channel's deleted.
819-
pass
820-
821804
if user_id != -1:
822805
if user_id in self.cache:
823806
return self.cache[user_id]

0 commit comments

Comments
 (0)