Catch HTTPExceptions instead of BadRequest

This commit is contained in:
Zeva Rose 2022-05-01 10:33:39 -06:00
parent b685823b79
commit 0e492938e7

View file

@ -8,7 +8,7 @@ import git
import psutil import psutil
from aiofile import AIOFile, LineReader from aiofile import AIOFile, LineReader
from dis_snek import MessageContext, Scale, Snake from dis_snek import MessageContext, Scale, Snake
from dis_snek.client.errors import BadRequest from dis_snek.client.errors import HTTPException
from dis_snek.client.utils.misc_utils import find from dis_snek.client.utils.misc_utils import find
from dis_snek.models.discord.embed import EmbedField from dis_snek.models.discord.embed import EmbedField
from dis_snek.models.discord.file import File from dis_snek.models.discord.file import File
@ -145,7 +145,7 @@ class BotutilCog(Scale):
reloaded.append(module) reloaded.append(module)
file_changes = {} file_changes = {}
for change in changes: for change in sorted(changes, key=lambda x: x.commit.committed_datetime, reverse=True):
if change.commit.hexsha == current_hash: if change.commit.hexsha == current_hash:
break break
files = change.commit.stats.files files = change.commit.stats.files
@ -205,7 +205,7 @@ class BotutilCog(Scale):
self.logger.info("Updates applied") self.logger.info("Updates applied")
try: try:
await ctx.reply(f"```ansi\n{capture.get()}\n```", embed=embed) await ctx.reply(f"```ansi\n{capture.get()}\n```", embed=embed)
except BadRequest: except HTTPException:
await ctx.reply(f"Total Changes: {l_total}", embed=embed) await ctx.reply(f"Total Changes: {l_total}", embed=embed)
else: else: