scanner exception handling
This commit is contained in:
@@ -115,6 +115,7 @@ python3 src/main.py
|
|||||||
* **v1.14**
|
* **v1.14**
|
||||||
* `mobile/mention` arg to fix mobile bug
|
* `mobile/mention` arg to fix mobile bug
|
||||||
* `%repeat`, `%mobile` to repeat commands
|
* `%repeat`, `%mobile` to repeat commands
|
||||||
|
* bug fix
|
||||||
* **v1.13**
|
* **v1.13**
|
||||||
* improved scan `%words`
|
* improved scan `%words`
|
||||||
* remove old and unused logs at start and guild leaving
|
* remove old and unused logs at start and guild leaving
|
||||||
|
|||||||
+15
-2
@@ -57,6 +57,8 @@ class Scanner(ABC):
|
|||||||
):
|
):
|
||||||
args = list(args)
|
args = list(args)
|
||||||
guild = message.guild
|
guild = message.guild
|
||||||
|
progress = None
|
||||||
|
try:
|
||||||
with GuildLogs(guild) as logs:
|
with GuildLogs(guild) as logs:
|
||||||
# If "%cmd help" redirect to "%help cmd"
|
# If "%cmd help" redirect to "%help cmd"
|
||||||
if "help" in args:
|
if "help" in args:
|
||||||
@@ -168,7 +170,8 @@ class Scanner(ABC):
|
|||||||
logs.channels[channel.id].start_date
|
logs.channels[channel.id].start_date
|
||||||
for channel in self.channels
|
for channel in self.channels
|
||||||
if channel.id in logs.channels
|
if channel.id in logs.channels
|
||||||
and logs.channels[channel.id].start_date is not None
|
and logs.channels[channel.id].start_date
|
||||||
|
is not None
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -221,7 +224,9 @@ class Scanner(ABC):
|
|||||||
self.stop_date,
|
self.stop_date,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
logging.info(f"scan {guild.id} > results in {delta(t0):,}ms")
|
logging.info(
|
||||||
|
f"scan {guild.id} > results in {delta(t0):,}ms"
|
||||||
|
)
|
||||||
response = ""
|
response = ""
|
||||||
first = True
|
first = True
|
||||||
allowed_mentions = (
|
allowed_mentions = (
|
||||||
@@ -249,6 +254,14 @@ class Scanner(ABC):
|
|||||||
command_cache.cache(self, message, args)
|
command_cache.cache(self, message, args)
|
||||||
# Delete custom progress message
|
# Delete custom progress message
|
||||||
await progress.delete()
|
await progress.delete()
|
||||||
|
except Exception as error:
|
||||||
|
logging.exception(error)
|
||||||
|
await message.channel.send(
|
||||||
|
"An unexpected error happened while computing your command, we're sorry for the inconvenience.",
|
||||||
|
reference=message,
|
||||||
|
)
|
||||||
|
if progress is not None:
|
||||||
|
await progress.delete()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def init(self, message: discord.Message, *args: str) -> bool:
|
async def init(self, message: discord.Message, *args: str) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user