Skip to content

Commit

Permalink
🔧 Update Sentry DSN
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Dec 29, 2023
1 parent 6609f91 commit 9af014c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
5 changes: 4 additions & 1 deletion config.gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ timezone: "Asia/ShangHai"

# In-Chat logging settings, default settings logs directly into Kat, strongly advised to change
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_cmd:
Expand Down Expand Up @@ -73,6 +74,8 @@ ipv6: "False"

# Analytics
allow_analytic: "True"
sentry_api: ""
mixpanel_api: ""

# Speed_test cli path
speed_test_path: ""
Expand Down
13 changes: 8 additions & 5 deletions pagermaid/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Config:
API_ID = int(os.environ.get("API_ID", config["api_id"]))
API_HASH = os.environ.get("API_HASH", config["api_hash"])
except (ValueError, KeyError):
print("[Error] API_ID or API_HASH is invalid, use the default value.")
# TGX
API_ID = DEFAULT_API_ID
API_HASH = DEFAULT_API_HASH
Expand All @@ -63,15 +64,17 @@ class Config:
)
TTS = os.environ.get("PGM_TTS", config["application_tts"])
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"]))
ALLOW_ANALYTIC = strtobool(
os.environ.get("PGM_ALLOW_ANALYTIC", config["allow_analytic"]), True
)
SENTRY_API = (
"https://[email protected]/6617119"
)
MIXPANEL_API = "c79162511383b0fa1e9c062a2a86c855"
SENTRY_API = os.environ.get("SENTRY_API", config.get("sentry_api", ""))
if not SENTRY_API:
SENTRY_API = "https://[email protected]/4506478732443653"
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"])
DATE_FORM = os.environ.get("PGM_DATE_FORM", config["date_form"])
START_FORM = os.environ.get("PGM_START_FORM", config["start_form"])
Expand Down
6 changes: 3 additions & 3 deletions pagermaid/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ async def handler(client: Client, message: Message):
None,
"PGP Error report generated.",
)
await Hook.process_error_exec(
message, command, exc_info, exc_format
)
await Hook.process_error_exec(
message, command, exc_info, exc_format
)
if (message.chat.id, message.id) in read_context:
del read_context[(message.chat.id, message.id)]
if block_process:
Expand Down
2 changes: 2 additions & 0 deletions pagermaid/modules/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ async def sentry_init_id(bot: Client):

@Hook.process_error()
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.sender_chat.id if message.sender_chat else sender_id
sentry_sdk.set_context(
Expand Down

0 comments on commit 9af014c

Please sign in to comment.