aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-20 13:58:01 -0800
committerclarkzjw <[email protected]>2023-02-20 13:58:01 -0800
commit88ad58c3d3412162ffdeb96f49b789e7976cad07 (patch)
tree2aa451f8e64da94b34e71ed9b9c43fcba1f4b39e
parentf927324709d639adfcd5487c7740e3d60f2246b8 (diff)
downloadswarm2fediverse-88ad58c3d3412162ffdeb96f49b789e7976cad07.tar.gz
minor reformatting
-rw-r--r--bot.py12
-rw-r--r--config.py1
-rw-r--r--foursquare/query_poi.py7
-rw-r--r--toot.py1
4 files changed, 14 insertions, 7 deletions
diff --git a/bot.py b/bot.py
index 398e433..7679d7f 100644
--- a/bot.py
+++ b/bot.py
@@ -41,8 +41,8 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
41 hello = "Hello, this is `checkin.bot`. \n\n" \ 41 hello = "Hello, this is `checkin.bot`. \n\n" \
42 "This is a Telegram bot with functionality similar to Foursquare Swarm, " \ 42 "This is a Telegram bot with functionality similar to Foursquare Swarm, " \
43 "but check in and post your location to the Fediverse (Mastodon/Pleroma) instead of Twitter.\n\n" \ 43 "but check in and post your location to the Fediverse (Mastodon/Pleroma) instead of Twitter.\n\n" \
44 "Aware of privacy concerns, this bot will not store your location data."\ 44 "Aware of privacy concerns, this bot will not store your location data." \
45 "*Be safe and cautious when sharing your real time location on the web.* \n\n"\ 45 "*Be safe and cautious when sharing your real time location on the web.* \n\n" \
46 "Start using this bot by sharing your location using Telegram context menu to it." 46 "Start using this bot by sharing your location using Telegram context menu to it."
47 47
48 await update.message.reply_text(hello, parse_mode=telegram.constants.ParseMode.MARKDOWN) 48 await update.message.reply_text(hello, parse_mode=telegram.constants.ParseMode.MARKDOWN)
@@ -67,10 +67,12 @@ async def button(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
67 await query.answer() 67 await query.answer()
68 poi = get_loc(query.data) 68 poi = get_loc(query.data)
69 69
70 mastodon_client.status_post(f"I'm at {poi['name']} in {poi['locality']}, {poi['region']}, \n[OSM]({poi['osm_url']})", 70 status = mastodon_client.status_post(
71 visibility="private") 71 f"I'm at {poi['name']} in {poi['locality']}, {poi['region']}, {poi['osm_url']}",
72 visibility="private")
72 73
73 await query.edit_message_text(text=f"Selected option: {poi}") 74 await query.edit_message_text(text=f"Selected place: {poi['name']}\nPosted to Mastodon: {status['url']}",
75 parse_mode=telegram.constants.ParseMode.MARKDOWN)
74 76
75 77
76async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: 78async def help_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
diff --git a/config.py b/config.py
index a403db0..2469d0f 100644
--- a/config.py
+++ b/config.py
@@ -1,6 +1,7 @@
1# https://docs.python.org/3/library/configparser.html 1# https://docs.python.org/3/library/configparser.html
2 2
3import configparser 3import configparser
4
4config = configparser.ConfigParser() 5config = configparser.ConfigParser()
5config.read("config.ini") 6config.read("config.ini")
6 7
diff --git a/foursquare/query_poi.py b/foursquare/query_poi.py
index efdd1b1..e2d5625 100644
--- a/foursquare/query_poi.py
+++ b/foursquare/query_poi.py
@@ -1,11 +1,14 @@
1import requests
2import json 1import json
2
3import requests
4
3from config import FSQ_API_KEY 5from config import FSQ_API_KEY
4from dbstore.dbm_store import get_loc, store_loc 6from dbstore.dbm_store import store_loc
5 7
6POI_API_ENDPOINT = "https://api.foursquare.com/v3/places/nearby?ll={}%2C{}" 8POI_API_ENDPOINT = "https://api.foursquare.com/v3/places/nearby?ll={}%2C{}"
7OSM_ENDPOINT = "https://www.openstreetmap.org/?mlat={}&mlon={}&zoom=15&layers=M" 9OSM_ENDPOINT = "https://www.openstreetmap.org/?mlat={}&mlon={}&zoom=15&layers=M"
8 10
11
9def query_poi(latitude, longitude): 12def query_poi(latitude, longitude):
10 locations = list() 13 locations = list()
11 14
diff --git a/toot.py b/toot.py
index f1db858..e1995fd 100644
--- a/toot.py
+++ b/toot.py
@@ -1,4 +1,5 @@
1from mastodon import Mastodon 1from mastodon import Mastodon
2
2from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID 3from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID
3 4
4''' 5'''
Powered by cgit v1.2.3 (git 2.41.0)