Skip to content

Commit a2519e4

Browse files
authored
Merge pull request #111 from andresdelfino/add_repository_to_project
Add repository URL and Telegram group URL to project
2 parents b0b505f + 09a04ce commit a2519e4

File tree

6 files changed

+325
-54
lines changed

6 files changed

+325
-54
lines changed
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+
)

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/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)