Browse Source

Load bot info from environment

master
c0de 1 year ago
parent
commit
a356c50ce0
4 changed files with 24 additions and 1 deletions
  1. +1
    -0
      .gitignore
  2. +8
    -1
      README.md
  3. +7
    -0
      run.sh
  4. +8
    -0
      sample.env

+ 1
- 0
.gitignore View File

@ -4,3 +4,4 @@
*~
.vscode
.env
bot.session

+ 8
- 1
README.md View File

@ -9,11 +9,18 @@ The production environment will eventually be hosted at [save.c0de.link](https:/
This project uses [Pipenv](https://pipenv.readthedocs.io/en/latest/) to manage the dependencies, so install that first after cloning this repository.
* Install dependencies - `pipenv install`
* Create a Telegram bot (see Creating a Telegram Bot)
* Enter the environment - `pipenv shell`
* Start the server - `python server.py`
* Start the server - `bash run.sh`
The server will be running on `http://localhost:8080/`
### Creating a Telegram bot
1. Login to [my.telegram.org/apps](https://my.telegram.org/apps) and create a Web App - You will need the `api_id` and `api_hash`
1. Message the [BotFather](https://t.me/BotFather) to get an `api_token`
1. Copy `sample.env` to `.env` and fill in the details from the previous steps
## Available Requests
Now that you have a running server, you can issue requests via a web browser, curl, wget, etc to the following endpoints:

+ 7
- 0
run.sh View File

@ -0,0 +1,7 @@
#!/bin/bash
# Copyright 2020 - David Todd (c0de@c0defox.es)
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
# Part of the Simple Bookmark Service
source .env
python server.py

+ 8
- 0
sample.env View File

@ -0,0 +1,8 @@
#!/bin/bash
# Copyright 2020 - David Todd (c0de@c0defox.es)
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
# Part of the Simple Bookmark Service
export telethon_api_id=
export telethon_api_hash=
export telethon_token=

Loading…
Cancel
Save