Merge pull request 'v2.0--Docker-Idea' (#32) from v2.0--Docker-Idea into v2.0
Reviewed-on: #32
This commit is contained in:
commit
93d28c0ad4
@ -7,4 +7,4 @@ RUN pip3 install -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
CMD [ "python3", "main.py"] #Uncomment to start with the Docker Container
|
CMD [ "python3", "main.py"]
|
||||||
10
Dockerfile_standalone_DiscordScript
Normal file
10
Dockerfile_standalone_DiscordScript
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM python:3.8-buster
|
||||||
|
|
||||||
|
WORKDIR /Praxis
|
||||||
|
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "python3", "discord_script_standalone.py"]
|
||||||
10
Dockerfile_standalone_TwitchScript
Normal file
10
Dockerfile_standalone_TwitchScript
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM python:3.8-buster
|
||||||
|
|
||||||
|
WORKDIR /Praxis
|
||||||
|
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "python3", "twitch_script_standalone.py"]
|
||||||
10
Dockerfile_standalone_command
Normal file
10
Dockerfile_standalone_command
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM python:3.8-buster
|
||||||
|
|
||||||
|
WORKDIR /Praxis
|
||||||
|
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "python3", "standalone_command.py"]
|
||||||
22
README.md
22
README.md
@ -7,12 +7,28 @@ ___
|
|||||||
## Usage:
|
## Usage:
|
||||||
|
|
||||||
|
|
||||||
Run the following to enable these V2 modules.
|
Run the following to enable these V2 modules without Docker. (After you install requirements)</br>
|
||||||
|
`pip install -r requirements.txt`</br>
|
||||||
|
|
||||||
`python standalone_command.py`</br>
|
`python standalone_command.py`</br>
|
||||||
`python twitch_script_standalone`</br>
|
`python twitch_script_standalone.py`</br>
|
||||||
`python discord_script_standalone`</br>
|
`python discord_script_standalone.py`</br>
|
||||||
|
|
||||||
|
## Docker:
|
||||||
|
|
||||||
|
### Image Setup:
|
||||||
|
|
||||||
|
Use these commands to build the images.</br>
|
||||||
|
`docker build --file Dockerfile_standalone_command --tag standalone_command .`</br>
|
||||||
|
`docker build --file Dockerfile_standalone_TwitchScript --tag twitchscript_standalone .`</br>
|
||||||
|
`docker build --file Dockerfile_standalone_DiscordScript --tag discordscript_standalone .`</br>
|
||||||
|
|
||||||
|
### Docker-Compose Info:
|
||||||
|
|
||||||
|
To Start:
|
||||||
|
`docker-compose up`</br>
|
||||||
|
To Stop:
|
||||||
|
`docker-compose down`</br>
|
||||||
___
|
___
|
||||||
|
|
||||||
~~# V1 Info:~~
|
~~# V1 Info:~~
|
||||||
|
|||||||
@ -85,14 +85,14 @@ class Discord_Module(discord.Client):
|
|||||||
async def is_command(self, word: str) -> bool:
|
async def is_command(self, word: str) -> bool:
|
||||||
# todo need to url-escape word
|
# todo need to url-escape word
|
||||||
clean_param = urlencode({'name': word})
|
clean_param = urlencode({'name': word})
|
||||||
url = "http://localhost:5000/api/v1/command?%s" % clean_param
|
url = "http://standalone_command:5000/api/v1/command?%s" % clean_param
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
return resp.status_code == 200
|
return resp.status_code == 200
|
||||||
|
|
||||||
async def exec_command(self, realMessage: discord.Message, command: str, rest: str):
|
async def exec_command(self, realMessage: discord.Message, command: str, rest: str):
|
||||||
# todo need to url-escape command and rest
|
# todo need to url-escape command and rest
|
||||||
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Discord, 'user_name': realMessage.author.mention, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
|
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Discord, 'user_name': realMessage.author.mention, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
|
||||||
url = "http://localhost:5000/api/v1/exec?%s" % params
|
url = "http://standalone_command:5000/api/v1/exec?%s" % params
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
print("Got the following message: %s" % resp.text)
|
print("Got the following message: %s" % resp.text)
|
||||||
|
|||||||
16
docker-compose.yaml
Normal file
16
docker-compose.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
standalone_command:
|
||||||
|
image: standalone_command
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
environment:
|
||||||
|
- ISDOCKER=cat
|
||||||
|
twitchscript_standalone:
|
||||||
|
image: twitchscript_standalone
|
||||||
|
environment:
|
||||||
|
- ISDOCKER=cat
|
||||||
|
discordscript_standalone:
|
||||||
|
image: discordscript_standalone
|
||||||
|
environment:
|
||||||
|
- ISDOCKER=cat
|
||||||
@ -69,14 +69,14 @@ class Twitch_Module():
|
|||||||
def is_command(self, word: str) -> bool:
|
def is_command(self, word: str) -> bool:
|
||||||
# todo need to url-escape word
|
# todo need to url-escape word
|
||||||
clean_param = urlencode({'name': word})
|
clean_param = urlencode({'name': word})
|
||||||
url = "http://localhost:5000/api/v1/command?%s" % clean_param
|
url = "http://standalone_command:5000/api/v1/command?%s" % clean_param
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
return resp.status_code == 200
|
return resp.status_code == 200
|
||||||
|
|
||||||
def exec_command(self, realMessage: twitch.chat.Message, command: str, rest: str):
|
def exec_command(self, realMessage: twitch.chat.Message, command: str, rest: str):
|
||||||
# todo need to url-escape command and rest
|
# todo need to url-escape command and rest
|
||||||
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Twitch,'user_name': realMessage.sender, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
|
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Twitch,'user_name': realMessage.sender, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
|
||||||
url = "http://localhost:5000/api/v1/exec?%s" % params
|
url = "http://standalone_command:5000/api/v1/exec?%s" % params
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
print("Got the following message: %s" % resp.text)
|
print("Got the following message: %s" % resp.text)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user