Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Added Heroku + Docker Support (#10)
Browse files Browse the repository at this point in the history
* Added Heroku Button

* Docker Support

* No need to import it again

Should fix this in tgvcbot also.

Co-authored-by: Akshay Rajput <thehamkercat@gmail.com>
  • Loading branch information
Tejas61900 and TheHamkerCat authored Aug 18, 2021
1 parent 9568b36 commit d1a9159
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 11 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Official Arch Linux Docker Image
FROM archlinux:base-devel

# Installing Python
RUN curl -fsSL "https://repo.archlinuxcn.org/x86_64/glibc-linux4-2.33-4-x86_64.pkg.tar.zst" | bsdtar -C / -xvf -
RUN pacman -Syy && \
pacman --noconfirm --needed -Syu python3 \
python-pip
RUN pip3 install -U pip

# Installing Requirements
COPY . .
RUN pip3 install -U -r requirements.txt

# Running Luna
CMD ["python3","luna.py"]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: python3 luna.py
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,31 @@ A public running instance can be found on telegram as [@LunaChatBot](https://t.m

## Installation

1. `git clone https://github.com/thehamkercat/LunaChatBot`
2. `cd LunaChatBot`
3. `pip3 install -r requirements.txt` to install the requirements.
4. `cp sample_config.py config.py`
5. Edit `config.ini` with your own values.
6. Run with `python3 luna.py`
```sh
$ git clone https://github.com/thehamkercat/LunaChatBot
$ cd LunaChatBot
$ pip3 install -U -r requirements.txt
$ cp sample_config.py config.py
```
Edit `config.py` with your own values.
```sh
$ python3 luna.py
```


## Heroku

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/TheHamkerCat/LunaChatBot/tree/master)


## Docker

Follow Installation Guide.
```sh
$ sudo docker build -t luna .
$ sudo docker run luna
```

## Note

- For Any Help, Ask Here [ProgrammersHub](https://t.me/PatheticProgrammers)
39 changes: 39 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "Luna The Chat Bot",
"description": "Just another Telegram AI chat bot written in Python using Pyrogram.",
"repository": "https://github.com/TheHamkerCat/LunaChatBot",
"keywords" : [
"python",
"ai-bot",
"telegram-ai-bot",
"telegram-bot",
"pyrogram",
"arq"
],
"stack": "heroku-20",
"env": {
"bot_token": {
"description": "Your Bot's Api Token ,Get it from @BotFather",
"required": true
},
"ARQ_API_KEY": {
"description": "Get this from @ARQRobot",
"required": true
},
"LANGUAGE": {
"description": "Language of Chat Bot ,list --> https://py-googletrans.readthedocs.io/en/latest/#googletrans-languages",
"value": "en",
"required": true
},
"ARQ_API_BASE_URL": {
"description": "ARQ URL ,Don't Change It",
"value": "https://thearq.tech",
"required": true
}
},
"buildpacks": [
{
"url": "heroku/python"
}
]
}
8 changes: 7 additions & 1 deletion luna.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import re
import os
from asyncio import gather, get_event_loop, sleep

from aiohttp import ClientSession
from pyrogram import Client, filters, idle
from Python_ARQ import ARQ

from config import ARQ_API_BASE_URL, ARQ_API_KEY, LANGUAGE, bot_token
is_config = os.path.exists("config.py")

if is_config:
from config import *
else:
from sample_config import *

luna = Client(
":memory:",
Expand Down
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.9.6
18 changes: 14 additions & 4 deletions sample_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
bot_token = "16901971:AAFqdM_SQE1PB2P1xLr67k"
ARQ_API_KEY = "Get this from @ARQRobot"
HEROKU = True # Make it False if you're not deploying on heroku.

if HEROKU:
from os import environ

bot_token = environ["bot_token"]
ARQ_API_KEY = environ["ARQ_API_KEY"]
LANGUAGE = environ["LANGUAGE"]

# NOTE Fill this if you are not deploying on heroku.
if not HEROKU:

bot_token = "16901971:AAFqdM_SQE1PB2P1xLr67k"
ARQ_API_KEY = "Get this from @ARQRobot"
# List of supported languages >>
# https://py-googletrans.readthedocs.io/en/latest/#googletrans-languages

LANGUAGE = "en"
LANGUAGE = "en"

# Leave it as it is
ARQ_API_BASE_URL = "https://thearq.tech"

0 comments on commit d1a9159

Please sign in to comment.