Skip to content

Commit 2e1b247

Browse files
author
Koehler, Jonathan
committed
added tags in gpx.
1 parent dd21343 commit 2e1b247

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

bot_osm_edit.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
logger = logging.getLogger(__name__)
1313

14-
CHOOSING, TAG_CHOICE, VALUE_REPLY, TYPING_REPLY, LOCATION, TEXT, DESCRIPTION, NAME, GPX_SAVE, SAVE = range(10)
14+
CHOOSING, TAG_CHOICE, VALUE_REPLY, TYPING_REPLY, LOCATION, TEXT, GPX_DESCRIPTION, GPX_NAME, GPX_TAG, GPX_SAVE, SAVE = range(11)
1515

1616

1717
class ElemEditor:
@@ -34,10 +34,12 @@ def get_conversation(self):
3434
TYPING_REPLY: [MessageHandler(Filters.text, self.value),
3535
MessageHandler(Filters.location, self.location)
3636
],
37-
NAME: [MessageHandler(Filters.text, self.gpx_name)],
37+
GPX_NAME: [MessageHandler(Filters.text, self.gpx_name)],
3838

39-
DESCRIPTION: [CommandHandler('skip', self.gpx_up_content),
40-
MessageHandler(Filters.text, self.gpx_desc)],
39+
GPX_DESCRIPTION: [CommandHandler('skip', self.gpx_desc),
40+
MessageHandler(Filters.text, self.gpx_desc)],
41+
GPX_TAG: [CommandHandler('skip', self.gpx_up_content),
42+
MessageHandler(Filters.text, self.gpx_desc)],
4143

4244
GPX_SAVE:[CommandHandler('save', self.gpx_up_content),
4345
CallbackQueryHandler(self.gpx_toggles, 0)
@@ -66,16 +68,23 @@ def gpx_up(self, update: Update, context):
6668
data = open(update.effective_message.document.get_file().download()).read()
6769
context.user_data['gpx'] = osm.osm_util.Trace(None, data, None, None, None)
6870
update.message.reply_text('please send trace-name.')
69-
return NAME
71+
return GPX_NAME
7072

7173
def gpx_name(self, update, context):
7274
name = update.message.text
7375
context.user_data['gpx'].name = name
7476
update.message.reply_text('please write a Description, or use /skip .')
75-
return DESCRIPTION
77+
return GPX_DESCRIPTION
7678

7779
def gpx_desc(self, update, context):
78-
context.user_data['gpx'].desc = update.message.text
80+
if not update.message.text == '/skip':
81+
context.user_data['gpx'].desc = update.message.text
82+
update.message.reply_text('please send tags separated by \',\' or use /skip .')
83+
return GPX_TAG
84+
85+
def gpx_tag(self, update, context):
86+
tags = update.message.text.split(',')
87+
context.user_data['gpx'].tags = tags
7988
self.gpx_up_content(update, context)
8089
return GPX_SAVE
8190

0 commit comments

Comments
 (0)