Adding text to speech module and updating pip in the container

This commit is contained in:
Luke Robles 2018-04-13 10:02:07 -07:00
parent cf94718f00
commit 8118999343
5 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,7 @@ services:
before_script: before_script:
- apk add --no-cache python3 - apk add --no-cache python3
- pip install -U pip
- pip3 install -r app/requirements.txt - pip3 install -r app/requirements.txt
stages: stages:

View File

@ -2,6 +2,7 @@ FROM python:3.6.2-alpine3.6
ADD app/requirements.txt /requirements.txt ADD app/requirements.txt /requirements.txt
RUN apk update && \ RUN apk update && \
apk add --no-cache docker && \ apk add --no-cache docker && \
pip install -U pip && \
pip install -r requirements.txt pip install -r requirements.txt
ADD app /app ADD app /app
CMD python /app/dragon-bot.py CMD python /app/dragon-bot.py

View File

@ -2,6 +2,7 @@ FROM python:3.6.2-alpine3.6
ADD app/requirements.txt /requirements.txt ADD app/requirements.txt /requirements.txt
RUN apk update && \ RUN apk update && \
apk add --no-cache vim docker && \ apk add --no-cache vim docker && \
pip install -U pip && \
pip install -r requirements.txt pip install -r requirements.txt
ADD app /app ADD app /app

View File

@ -7,6 +7,7 @@ then imported into the main bot
import os import os
import requests import requests
from gtts import gTTS
import core_utils import core_utils
import decide import decide
@ -311,6 +312,21 @@ async def on_message(message):
"```{}```".format(' '.join(list(map(lambda x: x.name, message.author.roles)))) "```{}```".format(' '.join(list(map(lambda x: x.name, message.author.roles))))
) )
if message.content.startswith('!tts'):
myobj = gTTS(
text=' '.join(message.content.split()[1:]),
lang='en',
slow=False
)
file_path = '/tmp/memes.mp3'
myobj.save(file_path)
await client.send_file(
message.channel,
file_path,
)
os.remove(file_path)
if message.content.startswith('!wallpaper'): if message.content.startswith('!wallpaper'):
await client.send_message( await client.send_message(
message.channel, message.channel,

View File

@ -1,6 +1,7 @@
beautifulsoup4 beautifulsoup4
discord.py discord.py
docker docker
gTTS
pylint pylint
pyowm pyowm
requests requests