Skip to content

Commit

Permalink
Made the example Dockerfiles cache better. Manually adding in the off…
Browse files Browse the repository at this point in the history
…ice lines. Updated readme to point to example directory
  • Loading branch information
GregHilston committed Aug 27, 2020
1 parent ca19677 commit 76a16c4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ icon. You'll be brought to a page that lists your API token. This is what you'll

## Example

For full examples, see the [examples directory](https://github.com/GregHilston/Simple-Slack-Bot/tree/master/examples/)

To integrate with Simple Slack Bot, simply create an instance of it and register for notifications using a Python decorator.

This can be seen with the following code below. Our Simple Slack Bot will reply to every message of "Ping", with "Pong", to every channel it's a part of:
Expand Down Expand Up @@ -78,9 +80,6 @@ if __name__ == "__main__":

At this point, your callback functions will be executed every time Simple Slack Bot receives the appropriate event.

A repo of this example Ping Pong Bot can be found [here](https://github.com/GregHilston/Ping-Pong-Bot). Feel free to use it as a reference or fork it as a stating point!


### Debug Mode

Note: Simple Slack Bot can be initialized with debug mode turned on, which will display all debug messages out to stdout and stderr.
Expand Down Expand Up @@ -189,7 +188,6 @@ and then import it as usual
`from simple_slack_bot.simple_slack_bot import SimpleSlackBot`.

You'll also have to install Simple Slack Bot's dependencies using PyPi. A `requirements.txt` will be kept up to date, along side the `setup.py` for this use case and your convenience.

## Don't Forget

The bot will only reply to channels that it is in. Don't forget to invite your bot into channels of interest!
Expand Down
6 changes: 4 additions & 2 deletions examples/dice_bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ RUN apk update \
findutils wget util-linux grep libxml2-dev libxslt-dev \
&& pip3 install --upgrade pip

COPY . /app

WORKDIR /app

COPY requirements.txt /app

RUN pip3 install -r requirements.txt

COPY . /app

CMD ["python3", "dice_bot.py"]
6 changes: 4 additions & 2 deletions examples/ping_pong_bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ RUN apk update \
findutils wget util-linux grep libxml2-dev libxslt-dev \
&& pip3 install --upgrade pip

COPY . /app

WORKDIR /app

COPY requirements.txt /app

RUN pip3 install -r requirements.txt

COPY . /app

CMD ["python3", "ping_pong_bot.py"]
1 change: 1 addition & 0 deletions examples/the_office_bot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the_office_lines_scripts.csv
6 changes: 4 additions & 2 deletions examples/the_office_bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ RUN apk update \
findutils wget util-linux grep libxml2-dev libxslt-dev \
&& pip3 install --upgrade pip

COPY . /app

WORKDIR /app

COPY requirements.txt /app

RUN pip3 install -r requirements.txt

COPY . /app

CMD ["python3", "the_office_bot.py"]
6 changes: 1 addition & 5 deletions examples/the_office_bot/the_office_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ def read_in_characters_lines():
"""Stores all characters' lines into a dictionary
"""

import requests as rs
csv_url="https://docs.google.com/spreadsheets/d/18wS5AAwOh8QO95RwHLS95POmSNKA2jjzdt0phrxeAE0/export?format=csv&id=18wS5AAwOh8QO95RwHLS95POmSNKA2jjzdt0phrxeAE0&gid=0"
res=rs.get(url=csv_url)
open('the_office_lines_scripts.csv', 'wb').write(res.content)

with open(r"the_office_lines_scripts.csv", "r", encoding='utf-8') as csvfile:
csv_f = csv.reader(csvfile)
print(csv_f)

for _, _, _, _, line_text, speaker, _ in csv_f:
speaker = speaker.lower()
Expand Down

0 comments on commit 76a16c4

Please sign in to comment.