🔍 优化 Sentry

This commit is contained in:
Xtao_dada 2021-04-04 13:03:57 +08:00 committed by GitHub
parent 9efa803240
commit c23b558db5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,10 @@ redis = StrictRedis(host=redis_host, port=redis_port, db=redis_db)
async def save_id():
me = await bot.get_me()
sentry_sdk.set_user({"id": me.id, "ip_address": "{{auto}}"})
if me.username is not None:
sentry_sdk.set_user({"id": me.id, "name": me.first_name, "username": me.username, "ip_address": "{{auto}}"})
else:
sentry_sdk.set_user({"id": me.id, "name": me.first_name, "ip_address": "{{auto}}"})
logs.info("设置用户标识成功。")