updated readme

This commit is contained in:
2025-06-20 21:51:26 +03:00
parent 3d96ff2a71
commit 43b8f08e12
2 changed files with 81 additions and 5 deletions
+68 -2
View File
@@ -1,2 +1,68 @@
# travel-inspo # Travel Inspo
Telegram bot for travel inspirations
Travel Inspo is a Telegram bot that provides curated travel inspiration, destination facts, and stunning images to help users discover their next adventure. The bot combines information from Wikipedia and Unsplash to deliver both knowledge and visual inspiration for a variety of travel interests.
## Features
- Interactive Telegram bot interface
- Curated destination suggestions based on user interests (beaches, mountains, cities, adventure, ancient ruins)
- Fetches destination summaries and facts from Wikipedia
- Retrieves high-quality images from Unsplash, with proper photographer attribution
- Sends multiple images per destination request
## Getting Started
### Prerequisites
- Python 3.10 or higher
- Telegram account and a Telegram Bot Token (from [BotFather](https://core.telegram.org/bots#botfather))
- Unsplash API Access Key (register at [Unsplash Developers](https://unsplash.com/developers))
- Wikipedia API (no key required)
### Installation
1. Clone the repository:
```shell
git clone https://github.com/andwatiian/travel-inspo.git
cd travel-inspo
```
1. Install dependencies:
```shell
uv sync
```
1. Set up environment variables in a `.env` file in the project root:
```shell
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
UNSPLASH_ACCESS_KEY=your-unsplash-access-key
```
### Running the Bot
Start the bot with:
```shell
python main.py
```
The bot will start and listen for messages on Telegram.
## Usage
- Start a chat with your bot on Telegram.
- Use the `/start` command to begin.
- Select a travel interest from the provided keyboard.
- The bot will respond with destination information and four related images.
## Attribution
This project uses the Unsplash API for images. All images are credited to their respective photographers as required by Unsplash's guidelines.
## License
This project is licensed under the [MIT License](./LICENSE).
+13 -3
View File
@@ -62,19 +62,29 @@ async def button(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
image_data = get_unsplash_image(destination_name) image_data = get_unsplash_image(destination_name)
if image_data and info: if image_data and info:
image = image_data[0] # Get the first image # Send the first image with the main caption
first_image = image_data[0]
caption = ( caption = (
f"📍 *{destination_name}*\n\n" f"📍 *{destination_name}*\n\n"
f"{info['summary']}\n\n" f"{info['summary']}\n\n"
f"[Read more on Wikipedia]({info['url']})\n\n" f"[Read more on Wikipedia]({info['url']})\n\n"
f"📸 Photo by [{image['photographer_name']}]({image['photographer_profile']}) on Unsplash" f"📸 Photo by [{first_image['photographer_name']}]({first_image['photographer_profile']}) on Unsplash"
) )
await context.bot.send_photo( await context.bot.send_photo(
chat_id=query.message.chat.id, # type: ignore chat_id=query.message.chat.id, # type: ignore
photo=image["url"], photo=first_image["url"],
caption=caption, caption=caption,
parse_mode="Markdown", parse_mode="Markdown",
) )
# Send the next 3 images with just photographer credit
for image in image_data[1:]:
credit = f"📸 Photo by [{image['photographer_name']}]({image['photographer_profile']}) on Unsplash"
await context.bot.send_photo(
chat_id=query.message.chat.id, # type: ignore
photo=image["url"],
caption=credit,
parse_mode="Markdown",
)
else: else:
await context.bot.send_message( await context.bot.send_message(
chat_id=query.message.chat.id, # type: ignore chat_id=query.message.chat.id, # type: ignore