Skip to content

Commit 73c4fd0

Browse files
Merge branch 'master' into use_names_for_difficulty_levels
2 parents ec66af6 + d57898b commit 73c4fd0

File tree

10 files changed

+335
-65
lines changed

10 files changed

+335
-65
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Puede encontrar una documentación mas detallada para programadores en [https://
88

99
* TOKEN: Token del bot generado con BotFather.
1010
* PYCAMP_BOT_MASTER_KEY: Password para agregar nuevos admins.
11+
* SENTRY_DATA_SOURCE_NAME: ID de proyecto de Sentry para habilitar el monitoreo.
1112

1213
## Development
1314

@@ -20,21 +21,19 @@ Esto lo podes hacer hablandole a @BotFather que es el "Bot padre de todos los bo
2021
Una vez creado el bot, deberías tener un TOKEN\_PERSONAL (BotFather te lo da en el mismo proceso de
2122
creación).
2223

23-
Despues instala el paquete en modo desarrollo en un virtualenv
24+
Despues instala el paquete en modo desarrollo en un virtual environment
2425

2526
~~~bash
26-
virtualenv -p python3 venv
27+
python3 -m venv venv
2728
source venv/bin/activate
2829
pip install -e '.[dev]'
2930
~~~
3031

3132
y estas listo para trabajar.
3233

33-
`pip install freezegun` para correr los tests.
34-
3534
## Testeo
3635

37-
Para correr el bot ejecutá (desde el virtualenv):
36+
Para correr el bot ejecutá (con el virtual environment activado):
3837

3938
~~~bash
4039
TOKEN='TOKEN_PERSONAL' PYCAMP_BOT_MASTER_KEY='KEY' python bin/run_bot.py
@@ -49,6 +48,7 @@ Primero es necesario setear las siguientes variables de entorno:
4948

5049
* `TOKEN`: token del bot que se usará durante el pycamp (gestionar desde telegram con BotFather)
5150
* `PYCAMP_BOT_MASTER_KEY`: con alguna password secreta que se va a usar para acceder a comandos de superuser
51+
* `SENTRY_DATA_SOURCE_NAME`: ID del proyecto de Sentry "telegrambot" de la cuenta de PyAr
5252

5353
Una vez creadas las variables de entorno, correr el bot con el comando `python bin/run_bot.py`
5454

docs/source/comandos_bot.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Comandos de Administrador
99
-------------------------
1010

1111
- ``/su <password>``: Reclama permisos de admin, la contraseña es la usada en la variable de entorno ``PYCAMP_BOT_MASTER_KEY``.
12-
- ``/agregar_pycamp <pycamp_name>``: Crea el PyCamp en la DB.
1312
- ``/activar_pycamp <pycamp_name>``: Activa un Pycamp.
1413
- ``/empezar_pycamp``: Setea la fecha de inicio del pycamp activo.
1514
- ``/empezar_carga_proyectos``: Habilita la carga de los proyectos. En este punto los pycampistas pueden cargar sus proyectos, enviandole al bot el comando ``/cargar_proyecto``.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://docs.peewee-orm.com/en/latest/peewee/playhouse.html#schema-migrations
2+
3+
import peewee
4+
import playhouse.migrate
5+
6+
import pycamp_bot.models
7+
8+
9+
my_db = peewee.SqliteDatabase('pycamp_projects.db')
10+
migrator = playhouse.migrate.SqliteMigrator(my_db)
11+
12+
13+
playhouse.migrate.migrate(
14+
migrator.add_column(
15+
pycamp_bot.models.Project._meta.table_name,
16+
'repository_url',
17+
pycamp_bot.models.Project.repository_url,
18+
),
19+
migrator.add_column(
20+
pycamp_bot.models.Project._meta.table_name,
21+
'group_url',
22+
pycamp_bot.models.Project.group_url,
23+
),
24+
)

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ name = "PyCamp_Bot"
77
version = "3.0"
88
dependencies = [
99
"munch==4.0.0",
10-
"python-telegram-bot==21.3",
11-
"peewee==3.17.5",
12-
"sentry-sdk==2.8.0",
10+
"python-telegram-bot==21.10",
11+
"peewee==3.17.9",
12+
"sentry-sdk==2.22.0",
1313
]
1414
requires-python = "==3.10.*"
1515
authors = [
@@ -20,9 +20,9 @@ readme = "README.md"
2020

2121
[project.optional-dependencies]
2222
dev = [
23-
"flake8==7.1.0",
23+
"flake8==7.1.2",
2424
"freezegun==1.5.1",
25-
"pytest==8.2.2",
25+
"pytest==8.3.4",
2626
]
2727
doc = [
2828
"sphinx==7.3.7",

src/pycamp_bot/commands/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
from pycamp_bot.commands.help_msg import get_help
33
from pycamp_bot.logger import logger
44

5+
import os
6+
57

68
async def msg_to_active_pycamp_chat(bot, text):
7-
chat_id = -1001404878013 # Prueba
8-
await bot.send_message(
9-
chat_id=chat_id,
10-
text=text
11-
)
9+
if 'TEST_CHAT_ID' in os.environ:
10+
chat_id = -1001404878013 # Prueba
11+
await bot.send_message(
12+
chat_id=os.environ['TEST_CHAT_ID'],
13+
text=text
14+
)
1215

1316

1417
async def start(update, context):

src/pycamp_bot/commands/help_msg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
Be AWARE, you have sudo\\.\\.\\.
5050
5151
Pycamp:
52-
/agregar\\_pycamp \\(pycamp\\): Agrega un pycamp\\.
5352
/activar\\_pycamp \\(pycamp\\): Setea un pycamp como activo \\(si ya hay uno activo lo \
5453
desactiva\\)\\.
5554
/empezar\\_carga\\_proyectos: Habilita la carga de proyectos en el pycamp activo\\.

src/pycamp_bot/commands/manage_pycamp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ async def define_duration(update, context):
152152
chat_id=update.message.chat_id,
153153
text=msg
154154
)
155+
return ConversationHandler.END
155156

156157

157158
async def cancel(update, context):

0 commit comments

Comments
 (0)