Skip to content

Commit ec399c3

Browse files
committed
Autoupdate now automatically updates pipenv dependencies if possible
1 parent 60e8444 commit ec399c3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
3535
- Use discord relative timedeltas. ([GH #3046](https://github.com/kyb3r/modmail/issues/3046))
3636
- Use discord native buttons for all paginator sessions.
3737
- `?help` and `?blocked` paginator sessions now have better multi-page UI.
38+
- Autoupdate now automatically updates pipenv dependencies if possible.
3839

3940
### Fixed
4041

bot.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1674,17 +1674,28 @@ async def autoupdate(self):
16741674
return
16751675

16761676
elif res != "Already up to date.":
1677+
if os.getenv("PIPENV_ACTIVE"):
1678+
# Update pipenv if possible
1679+
await asyncio.create_subprocess_shell(
1680+
"pipenv sync",
1681+
stderr=PIPE,
1682+
stdout=PIPE,
1683+
)
1684+
message = ""
1685+
else:
1686+
message = "\n\nDo manually update dependencies if your bot has crashed."
1687+
16771688
logger.info("Bot has been updated.")
16781689
channel = self.update_channel
16791690
if self.hosting_method in (HostingMethod.PM2, HostingMethod.SYSTEMD):
16801691
embed = discord.Embed(title="Bot has been updated", color=self.main_color)
1681-
embed.set_footer(text=f"Updating Modmail v{self.version} " f"-> v{latest.version}")
1692+
embed.set_footer(text=f"Updating Modmail v{self.version} " f"-> v{latest.version} {message}")
16821693
if self.config["update_notifications"]:
16831694
await channel.send(embed=embed)
16841695
else:
16851696
embed = discord.Embed(
16861697
title="Bot has been updated and is logging out.",
1687-
description="If you do not have an auto-restart setup, please manually start the bot.",
1698+
description=f"If you do not have an auto-restart setup, please manually start the bot. {message}",
16881699
color=self.main_color,
16891700
)
16901701
embed.set_footer(text=f"Updating Modmail v{self.version} -> v{latest.version}")

0 commit comments

Comments
 (0)