Skip to content

Commit cea8fdf

Browse files
committed
Implement Sentry
1 parent 68e8094 commit cea8fdf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

bin/run_bot.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
2+
23
from telegram.ext import Application, MessageHandler, filters
4+
import sentry_sdk
5+
36
from pycamp_bot.commands import auth
47
from pycamp_bot.commands import voting
58
from pycamp_bot.commands import manage_pycamp
@@ -12,6 +15,12 @@
1215
from pycamp_bot.models import models_db_connection
1316
from pycamp_bot.logger import logger
1417

18+
19+
SENTRY_DATA_SOURCE_NAME_ENVVAR = 'SENTRY_DATA_SOURCE_NAME'
20+
if SENTRY_DATA_SOURCE_NAME_ENVVAR in os.environ:
21+
sentry_sdk.init(dsn=os.environ[SENTRY_DATA_SOURCE_NAME_ENVVAR])
22+
23+
1524
async def unknown_command(update, context):
1625
text = "No reconozco el comando, para ver comandos válidos usá /ayuda"
1726
await context.bot.send_message(chat_id=update.message.chat_id, text=text)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies = [
99
"munch==4.0.0",
1010
"python-telegram-bot==21.3",
1111
"peewee==3.17.5",
12+
"sentry-sdk==2.6.0",
1213
]
1314
requires-python = "==3.10.*"
1415
authors = [

0 commit comments

Comments
 (0)