Skip to content

Commit e66459d

Browse files
authored
Merge pull request #83 from andresdelfino/implement_sentry
Implement Sentry
2 parents 939a811 + cea8fdf commit e66459d

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
@@ -13,6 +16,12 @@
1316
from pycamp_bot.models import models_db_connection
1417
from pycamp_bot.logger import logger
1518

19+
20+
SENTRY_DATA_SOURCE_NAME_ENVVAR = 'SENTRY_DATA_SOURCE_NAME'
21+
if SENTRY_DATA_SOURCE_NAME_ENVVAR in os.environ:
22+
sentry_sdk.init(dsn=os.environ[SENTRY_DATA_SOURCE_NAME_ENVVAR])
23+
24+
1625
async def unknown_command(update, context):
1726
text = "No reconozco el comando, para ver comandos válidos usá /ayuda"
1827
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)