-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a91bd0b
commit 39fc9ad
Showing
15 changed files
with
121 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,42 +51,43 @@ async def report(event: ExceptionThrown, avilla: Avilla): | |
with StringIO() as fp: | ||
traceback.print_tb(event.exception.__traceback__, file=fp) | ||
tb = fp.getvalue() | ||
msg = f"""\ | ||
data = { | ||
"event": str(event.event.__repr__()), | ||
"exctype": str(type(event.exception)), | ||
"exc": str(event.exception), | ||
"traceback": tb, | ||
} | ||
masters = {conf.master_id for conf in bot.config.bots} | ||
if api: | ||
masters = {f"{conf.master_id}@qq.com" for conf in bot.config.bots} | ||
with suppress(Exception): | ||
await api.send_email( | ||
"[email protected]", | ||
[f"{master}@qq.com" for master in masters], | ||
"Exception Occur", | ||
27228, | ||
data, | ||
) | ||
template = """\ | ||
## 异常事件: | ||
`{str(event.event.__repr__())}` | ||
`{event}` | ||
## 异常类型: | ||
`{type(event.exception)}` | ||
`{exctype}` | ||
## 异常内容: | ||
{str(event.exception)} | ||
{exc} | ||
## 异常追踪: | ||
```py | ||
{tb} | ||
{traceback} | ||
``` | ||
""" | ||
masters = {conf.master_id for conf in bot.config.bots} | ||
if api: | ||
masters = {f"{conf.master_id}@qq.com" for conf in bot.config.bots} | ||
with suppress(Exception): | ||
await api.send_email( | ||
"[email protected]", | ||
[f"{master}@qq.com" for master in masters], | ||
"Exception Occur", | ||
"27228", | ||
{ | ||
"event": str(event.event.__repr__()), | ||
"exctype": str(type(event.exception)), | ||
"exc": str(event.exception), | ||
"traceback": tb, | ||
}, | ||
) | ||
img = await md2img(msg, 1500) | ||
img = await md2img(template.format_map(data), 1500) | ||
if not (accounts := avilla.get_accounts(account_type=ElizabethAccount)): | ||
return | ||
for account in accounts: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.