Skip to content

Commit c3052f6

Browse files
committed
Fix mention, spam in autoupdate
1 parent a7d3345 commit c3052f6

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ however, insignificant breaking changes do not guarantee a major version bump, s
1010

1111
### Fixed
1212

13+
- Autoupdate persists despite errors
14+
- Mention when normal thread created was not working.
15+
16+
# v3.7.5
17+
18+
### Fixed
19+
1320
- Close on emoji was not working.
1421

1522
# v3.7.3

bot.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.7.5"
1+
__version__ = "3.7.6"
22

33

44
import asyncio
@@ -1479,10 +1479,17 @@ async def autoupdate(self):
14791479
else:
14801480
command = "git pull"
14811481
proc = await asyncio.create_subprocess_shell(command, stderr=PIPE, stdout=PIPE,)
1482+
err = await proc.stderr.read()
1483+
err = err.decode("utf-8").rstrip()
14821484
res = await proc.stdout.read()
14831485
res = res.decode("utf-8").rstrip()
14841486

1485-
if res != "Already up to date.":
1487+
if err:
1488+
logger.warning(f"Autoupdate failed: {err}")
1489+
self.autoupdate_loop.cancel()
1490+
return
1491+
1492+
elif res != "Already up to date.":
14861493
logger.info("Bot has been updated.")
14871494
channel = self.log_channel
14881495
if self.hosting_method == HostingMethod.PM2:

cogs/utility.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import random
55
import re
6+
from sys import stdout
67
import traceback
78
from contextlib import redirect_stdout
89
from datetime import datetime
@@ -1920,10 +1921,18 @@ async def update(self, ctx, *, flag: str = ""):
19201921
command = "git pull"
19211922

19221923
proc = await asyncio.create_subprocess_shell(command, stderr=PIPE, stdout=PIPE,)
1924+
err = await proc.stderr.read()
1925+
err = err.decode("utf-8").rstrip()
19231926
res = await proc.stdout.read()
19241927
res = res.decode("utf-8").rstrip()
19251928

1926-
if res != "Already up to date.":
1929+
if err:
1930+
embed = discord.Embed(
1931+
title="Update failed", description=err, color=self.bot.error_color
1932+
)
1933+
await ctx.send(embed=embed)
1934+
1935+
elif res != "Already up to date.":
19271936
logger.info("Bot has been updated.")
19281937

19291938
embed = discord.Embed(title="Bot has been updated", color=self.bot.main_color,)

core/thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def setup(self, *, creator=None, category=None, initial_message=None):
155155
await channel.edit(topic=f"User ID: {recipient.id}")
156156
self.ready = True
157157

158-
if creator != recipient:
158+
if creator is not None and creator != recipient:
159159
mention = None
160160
else:
161161
mention = self.bot.config["mention"]

0 commit comments

Comments
 (0)