🔧 Update Sentry DSN

This commit is contained in:
xtaodada 2023-12-29 19:40:53 +08:00
parent 6609f91ce8
commit 9af014c6b7
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
4 changed files with 17 additions and 9 deletions

View File

@ -33,7 +33,8 @@ timezone: "Asia/ShangHai"
# In-Chat logging settings, default settings logs directly into Kat, strongly advised to change # In-Chat logging settings, default settings logs directly into Kat, strongly advised to change
log: "False" log: "False"
log_chatid: "503691334" # chat id of the log group, such as -1001234567890, also can use username, such as "telegram"
log_chatid: "me"
# Disabled Built-in Commands # Disabled Built-in Commands
disabled_cmd: disabled_cmd:
@ -73,6 +74,8 @@ ipv6: "False"
# Analytics # Analytics
allow_analytic: "True" allow_analytic: "True"
sentry_api: ""
mixpanel_api: ""
# Speed_test cli path # Speed_test cli path
speed_test_path: "" speed_test_path: ""

View File

@ -42,6 +42,7 @@ class Config:
API_ID = int(os.environ.get("API_ID", config["api_id"])) API_ID = int(os.environ.get("API_ID", config["api_id"]))
API_HASH = os.environ.get("API_HASH", config["api_hash"]) API_HASH = os.environ.get("API_HASH", config["api_hash"])
except (ValueError, KeyError): except (ValueError, KeyError):
print("[Error] API_ID or API_HASH is invalid, use the default value.")
# TGX # TGX
API_ID = DEFAULT_API_ID API_ID = DEFAULT_API_ID
API_HASH = DEFAULT_API_HASH API_HASH = DEFAULT_API_HASH
@ -63,15 +64,17 @@ class Config:
) )
TTS = os.environ.get("PGM_TTS", config["application_tts"]) TTS = os.environ.get("PGM_TTS", config["application_tts"])
LOG = strtobool(os.environ.get("PGM_LOG", config["log"])) LOG = strtobool(os.environ.get("PGM_LOG", config["log"]))
LOG_ID = int(os.environ.get("PGM_LOG_ID", config["log_chatid"])) LOG_ID = os.environ.get("PGM_LOG_ID", config["log_chatid"])
IPV6 = strtobool(os.environ.get("PGM_IPV6", config["ipv6"])) IPV6 = strtobool(os.environ.get("PGM_IPV6", config["ipv6"]))
ALLOW_ANALYTIC = strtobool( ALLOW_ANALYTIC = strtobool(
os.environ.get("PGM_ALLOW_ANALYTIC", config["allow_analytic"]), True os.environ.get("PGM_ALLOW_ANALYTIC", config["allow_analytic"]), True
) )
SENTRY_API = ( SENTRY_API = os.environ.get("SENTRY_API", config.get("sentry_api", ""))
"https://2e13a517aeb542e7a307cba8996b6d1a@o1342815.ingest.sentry.io/6617119" if not SENTRY_API:
) SENTRY_API = "https://79584904859c93d48dbc71d73e76a51a@o416616.ingest.sentry.io/4506478732443653"
MIXPANEL_API = "c79162511383b0fa1e9c062a2a86c855" MIXPANEL_API = os.environ.get("MIXPANEL_API", config.get("mixpanel_api"))
if not MIXPANEL_API:
MIXPANEL_API = "c79162511383b0fa1e9c062a2a86c855"
TIME_FORM = os.environ.get("PGM_TIME_FORM", config["time_form"]) TIME_FORM = os.environ.get("PGM_TIME_FORM", config["time_form"])
DATE_FORM = os.environ.get("PGM_DATE_FORM", config["date_form"]) DATE_FORM = os.environ.get("PGM_DATE_FORM", config["date_form"])
START_FORM = os.environ.get("PGM_START_FORM", config["start_form"]) START_FORM = os.environ.get("PGM_START_FORM", config["start_form"])

View File

@ -229,9 +229,9 @@ def listener(**args):
None, None,
"PGP Error report generated.", "PGP Error report generated.",
) )
await Hook.process_error_exec( await Hook.process_error_exec(
message, command, exc_info, exc_format message, command, exc_info, exc_format
) )
if (message.chat.id, message.id) in read_context: if (message.chat.id, message.id) in read_context:
del read_context[(message.chat.id, message.id)] del read_context[(message.chat.id, message.id)]
if block_process: if block_process:

View File

@ -58,6 +58,8 @@ async def sentry_init_id(bot: Client):
@Hook.process_error() @Hook.process_error()
async def sentry_report(message: Message, command, exc_info, **_): async def sentry_report(message: Message, command, exc_info, **_):
if not Config.ERROR_REPORT:
return
sender_id = message.from_user.id if message.from_user else "" sender_id = message.from_user.id if message.from_user else ""
sender_id = message.sender_chat.id if message.sender_chat else sender_id sender_id = message.sender_chat.id if message.sender_chat else sender_id
sentry_sdk.set_context( sentry_sdk.set_context(