Telegram bot for easy currency conversion with extensive features.
See @inintobot
The implementation consists of the following components:
buildSrc
- project with Gradle build-scriptscommon
- common utilities and interfaces, also objects containing list of available currencies and rate apis.fetch-rates
- function which downloads the latest rates and populates the designated store (supposed to be running on schedule)
See classorg.mksn.inintobot.rates.FetchRequest
for input object parametersexchange-rates
- main module which containing bot logicmigrate-settings
- one-time function which designated to migrate existing settings from Postgres SQL.
See classorg.mksn.inintobot.migrate.MigrateInput
for input object parameters To deploy:gcloud functions deploy inintobot-exchange-rates \ --entry-point=org.mksn.inintobot.gcp.function.Function \ --memory=512MB --runtime=java11 --trigger-http --source=build/libs \ --region=europe-central2
componud-server
- project which connectsfetch-rates
andexchange-rates
functions into a single executable server Require envs from bothfetch-rates
andexchange-rates
projects to be setplatform-gcp
- set of platform-related projects (or just configurations) to deploy the bot on GCP and save data into Firestoreapp-engine
- GCP version ofcompund-server
project. Fillapp.yaml
with required envs.function
- adapter implementation between common function interface and GCP cloud functions interfacestore
- GCP Firestore implementation of common storage interfacesfunction-exchange-rates
- GCP version ofexchange-rates
project. To deploy:gcloud functions deploy inintobot-exchange-rates \ --entry-point=org.mksn.inintobot.gcp.function.Function \ --memory=512MB --runtime=java11 --trigger-http --source=build/libs \ --region=europe-central2 --min-instances=1 \ --set-env-vars BOT_TOKEN=<bot token>,BOT_USERNAME=<bot username>,CREATOR_ID=<id of admin>
function-fetch-rates
- GCP version ofexchange-rates
project. To deploy:gcloud functions deploy inintobot-fetch-rates \ --entry-point=org.mksn.inintobot.gcp.function.Function \ --memory=512MB --runtime=java11 --trigger-http --source=build/libs \ --region=europe-central2 \ --set-env-vars FIXER_ACCESS_KEY=<token>,FOREX_ACCESS_KEY=<token>,OPENEXCHANGERATES_ACCESS_KEY=<token>,TRADERMADE_ACCESS_KEY=<token>
function-migrate-settings
- GCP version ofmigrate-settings
project. To deploy:gcloud functions deploy inintobot-migrate-settings \ --entry-point=org.mksn.inintobot.gcp.function.Function \ --memory=512MB --runtime=java11 --trigger-http --source=build/libs \ --region=europe-central2
To set webhook:
curl -X "POST" "https://api.telegram.org/bot<token>/setWebhook" \
-d '{"drop_pending_updates": true, "url": "<app-link>", "allowed_updates": ["edited_message", "inline_query", "message", "chosen_inline_result", "callback_query"]}' \
-H 'Content-Type: application/json; charset=utf-8'