aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.py12
-rw-r--r--command.py18
-rw-r--r--config.py1
-rw-r--r--foursquare/poi.py2
-rw-r--r--prompt/string.py38
5 files changed, 60 insertions, 11 deletions
diff --git a/bot.py b/bot.py
index 35884ff..45b2af7 100644
--- a/bot.py
+++ b/bot.py
@@ -39,7 +39,11 @@ from command import (
39 start_command, 39 start_command,
40 fedi_login_command, 40 fedi_login_command,
41 cancel_command, 41 cancel_command,
42 help_command 42 help_command,
43 tos_command,
44 toggle_visibility_command,
45 logout_command,
46 list_command
43) 47)
44from config import ( 48from config import (
45 FEDI_LOGIN, 49 FEDI_LOGIN,
@@ -149,7 +153,11 @@ async def main() -> None:
149 ) 153 )
150 154
151 # register handlers 155 # register handlers
152 application.add_handler(CommandHandler("help", help_command)) 156 application.add_handler(CommandHandler("tos", tos_command))
157 application.add_handler(CommandHandler("vis", toggle_visibility_command))
158 application.add_handler(CommandHandler("logout", logout_command))
159 application.add_handler(CommandHandler("list", list_command))
160 application.add_handler(CommandHandler("Help", help_command))
153 application.add_handler(checkin_handler) 161 application.add_handler(checkin_handler)
154 application.add_handler(TypeHandler(type=FediLoginCallbackUpdate, callback=process_oauth_login_callback)) 162 application.add_handler(TypeHandler(type=FediLoginCallbackUpdate, callback=process_oauth_login_callback))
155 163
diff --git a/command.py b/command.py
index 7426901..22f7066 100644
--- a/command.py
+++ b/command.py
@@ -25,7 +25,23 @@ async def fedi_login_command(update: Update, context: ContextTypes.DEFAULT_TYPE)
25 25
26 26
27async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: 27async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
28 await update.message.reply_text(PROMPT_HELP) 28 await update.message.reply_text(PROMPT_HELP, parse_mode=ParseMode.MARKDOWN, reply_markup=MAIN_MENU)
29
30
31async def tos_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
32 await update.message.reply_text(PROMPT_TOS, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU)
33
34
35async def list_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
36 await update.message.reply_text(PROMPT_LIST, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU)
37
38
39async def logout_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
40 await update.message.reply_text(PROMPT_LOGOUT, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU)
41
42
43async def toggle_visibility_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
44 await update.message.reply_text(PROMPT_TOGGLE_VIS, parse_mode=ParseMode.HTML, reply_markup=MAIN_MENU)
29 45
30 46
31async def cancel_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 47async def cancel_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
diff --git a/config.py b/config.py
index d5455a3..b2025ca 100644
--- a/config.py
+++ b/config.py
@@ -16,6 +16,7 @@ FEDI_LOGIN, WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_M
16 16
17MAIN_MENU = ReplyKeyboardMarkup([ 17MAIN_MENU = ReplyKeyboardMarkup([
18 [KeyboardButton(text="Check-in here", request_location=True)], 18 [KeyboardButton(text="Check-in here", request_location=True)],
19 [KeyboardButton(text="/Help")]
19]) 20])
20 21
21SKIP_LOCATION_SEARCH = CALLBACK_SKIP 22SKIP_LOCATION_SEARCH = CALLBACK_SKIP
diff --git a/foursquare/poi.py b/foursquare/poi.py
index ea3509f..39895b7 100644
--- a/foursquare/poi.py
+++ b/foursquare/poi.py
@@ -1,7 +1,5 @@
1import json 1import json
2
3import requests 2import requests
4
5from config import FSQ_API_KEY 3from config import FSQ_API_KEY
6from dbstore.peewee_store import create_or_update_poi 4from dbstore.peewee_store import create_or_update_poi
7 5
diff --git a/prompt/string.py b/prompt/string.py
index a7bf0d1..eda0df8 100644
--- a/prompt/string.py
+++ b/prompt/string.py
@@ -1,9 +1,23 @@
1PROMPT_START = "Hello, this is `checkin.bot`. \n\n" \ 1PROMPT_START = "Hello, this is `checkin.bot`. \n\n" \
2 "This is a Telegram bot with functionality similar to Foursquare Swarm, " \ 2 "This is a Telegram bot with functionality similar to Foursquare Swarm, " \
3 "but check in and post your location to the Fediverse (Mastodon/Pleroma) instead of Twitter.\n\n" \ 3 "but check in and post your location to the Fediverse (Mastodon/Pleroma) instead of Twitter.\n\n" \
4 "Aware of privacy concerns, this bot will not store your location data." \ 4 "Aware of privacy concerns, this bot will not store your location data." \
5 "*Be safe and cautious when sharing your real time location on the web.* \n\n" \ 5 "*Be safe and cautious when sharing your real time location on the web.* \n\n" \
6 "Start using this bot by sharing your location using Telegram context menu to it." 6 "Start using this bot by sharing your location using Telegram context menu to it."
7
8PROMPT_TOS = """
9By using this bot, you agree to the following terms of service:\n\n
10
11<b>Data Collection</b>
12
13<b>Server Logs</b>
14
15<b>Server Locations</b>
16
17<b>Data Sharing</b>
18"""
19
20
7PROMPT_FEDI_LOGIN_WHERE_IS_INSTANCE = "Where is your home instance in the Fediverse? (e.g. `https://mastodon.social`)" 21PROMPT_FEDI_LOGIN_WHERE_IS_INSTANCE = "Where is your home instance in the Fediverse? (e.g. `https://mastodon.social`)"
8PROMPT_FEDI_LOGIN = "Please login to your Fediverse account by clicking the link below:" 22PROMPT_FEDI_LOGIN = "Please login to your Fediverse account by clicking the link below:"
9PROMPT_CHOOSE_ACTION = "Use bot keyboard to choose an action" 23PROMPT_CHOOSE_ACTION = "Use bot keyboard to choose an action"
@@ -12,9 +26,21 @@ PROMPT_ADD_MEDIA = "You can continue adding photos, or press skip"
12PROMPT_LOCATION_KEYWORD = "You can input location search keywords or press skip" 26PROMPT_LOCATION_KEYWORD = "You can input location search keywords or press skip"
13PROMPT_WAIT_LOCATION_CONFIRMATION_NO_NEARBY_POI = "No nearby places found. But you can input location name manually." 27PROMPT_WAIT_LOCATION_CONFIRMATION_NO_NEARBY_POI = "No nearby places found. But you can input location name manually."
14PROMPT_WAIT_LOCATION_CONFIRMATION = "Where are you?" 28PROMPT_WAIT_LOCATION_CONFIRMATION = "Where are you?"
15PROMPT_HELP = "Use /start to test this bot."
16PROMPT_CANCELED = "Canceled" 29PROMPT_CANCELED = "Canceled"
17PROMPT_MAX_PHOTO_REACHED = "Cannot attach more than 4 medias, only first 4 will be posted" 30PROMPT_MAX_PHOTO_REACHED = "Cannot attach more than 4 medias, only first 4 will be posted"
18PROMPT_DONE = "Done" 31PROMPT_DONE = "Done"
32PROMPT_HELP = "Available commands:" \
33 "\n`/login` - login to Fediverse account. " \
34 "You can use this command to login to multiple Fediverse accounts" \
35 "\n`/list` - list current linked Fediverse accounts" \
36 "\n`/logout [number]` - logout from specified Fediverse account, default logout from all" \
37 "\n`/vis public|private|unlisted [number]` - " \
38 "toggle visibility of your checkins on specified instances, default=private" \
39 "\n`/tos` - show ToS message" \
40 "\n`/cancel` - cancel current operation during checkins"
41
42PROMPT_LIST = "List all linked Fediverse accounts"
43PROMPT_LOGOUT = "Choose Fediverse account to logout"
44PROMPT_TOGGLE_VIS = "Choose visibility of your checkins on Fediverse"
19 45
20CALLBACK_SKIP = "Skip" 46CALLBACK_SKIP = "Skip"
Powered by cgit v1.2.3 (git 2.41.0)