mirror of
https://github.com/andwati/travel-inspo.git
synced 2026-10-18 02:02:52 +00:00
updated readme
This commit is contained in:
@@ -1,2 +1,68 @@
|
||||
# travel-inspo
|
||||
Telegram bot for travel inspirations
|
||||
# Travel Inspo
|
||||
|
||||
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
@@ -62,19 +62,29 @@ async def button(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
image_data = get_unsplash_image(destination_name)
|
||||
|
||||
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 = (
|
||||
f"📍 *{destination_name}*\n\n"
|
||||
f"{info['summary']}\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(
|
||||
chat_id=query.message.chat.id, # type: ignore
|
||||
photo=image["url"],
|
||||
photo=first_image["url"],
|
||||
caption=caption,
|
||||
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:
|
||||
await context.bot.send_message(
|
||||
chat_id=query.message.chat.id, # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user