Skip to content

Commit

Permalink
Dockerize bot, set up solitary server using docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Aabhash committed Jan 27, 2020
1 parent 3569287 commit a7bd476
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.7-slim

RUN apt-get update

RUN apt-get install enchant -y

RUN apt-get install gcc -y

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

RUN python -m nltk.downloader punkt

RUN python -m spacy download en_core_web_sm

COPY . /app

RUN pip install -e .

RUN python -m src.bot.bot
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.3'

services:
crowmaster:
image: crowmaster:1.0
build:
context: .
environment:
- ENV=TEST
- TST_SUBS=test
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
dotenv
python-dotenv
praw
pandas
sklearn
pandas==0.24.2
numpy==1.16.4
scipy==1.3.0
spacy
deeppavlov
pytest
4 changes: 2 additions & 2 deletions src/bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
logger.info("Going through all comments ...")
for comment in comments:
username = helper.get_username(comment.author)
if comment.id not in posts_replied_to:

if comment.id not in posts_replied_to and comment.author != config.bot_name:
logger.info(f"{comment.id}, {username}")
if helper.is_triggered(triggers, comment.body):
comment.reply(helper.get_random_quote(comment.body))
logger.info(
Expand Down
3 changes: 2 additions & 1 deletion src/bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
trigger_file = "src/bot/trigger.json"
sub_json = "src/bot/subs.json"
praw_ini = "praw.ini"
env = "src/bot/.env"
env = "src/bot/.env"
bot_name = 'crowmaster-bot'
Empty file added tests/__init__.py
Empty file.

0 comments on commit a7bd476

Please sign in to comment.