Skip to content

Commit

Permalink
Basic Function will work
Browse files Browse the repository at this point in the history
  • Loading branch information
yutoml committed Dec 9, 2023
1 parent ee184b1 commit 30a9b8d
Show file tree
Hide file tree
Showing 13 changed files with 331 additions and 157 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ ipython_config.py
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM python:3.10
WORKDIR /app
ENV LC_ALL=C.UTF-8
COPY . .
RUN pwd && pip install pipenv && pipenv --python 3.10 && pipenv install
RUN pip install pipenv && pipenv --python 3.10
COPY Pipfile /app/
COPY .env /app/
RUN pipenv install
COPY slack_translator_bot/ /app/slack_translator_bot/
CMD ["pipenv", "run", "start"]
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deepl = "*"
slack-bolt = "*"

[scripts]
start = "python slack-translator-bot/main.py"
start = "python slack_translator_bot/main.py"

[dev-packages]

Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# slack-translator-bot
# slack_translator_bot

## 概要

Expand All @@ -8,3 +8,12 @@ Slack上でdeeplのapiを利用して翻訳をおこなうbot.

* 特定の人物にメンションしているメッセージをメンションされた人物にとって適切な言語で翻訳
* 特定のリアクションがついたメッセージにそのリアクションで指定される言語で翻訳

## 実行方法

* dockerfileからimageを作成し、このディレクトリを/appにマウントして実行する

```sh
docker build . -t slacktranslatorbot
docker run -it --volume $PWD/data/:/app/data slacktranslatorbot
```
11 changes: 11 additions & 0 deletions data/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.10"
1 change: 1 addition & 0 deletions data/auto_translation_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"U01UEQLV960": ["EN-US", "ZH"], "null": ["EN-US"]}
19 changes: 19 additions & 0 deletions data/language_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"languages": [
{
"code": "JA",
"reaction": "jp",
"language": "Japanese"
},
{
"code": "EN-US",
"reaction": "us",
"language": "American English"
},
{
"code": "ZH",
"reaction": "cn",
"language": "Chinese"
}
]
}
36 changes: 27 additions & 9 deletions setting.json → data/modal.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"automatic_translation_setting": {
"user": "JA"
},
"modal_view": {
"auto_translation_config_modal_view": {
"type": "modal",
"callback_id": "modal-id",
"callback_id": "auto_translation_config",
"title": {
"type": "plain_text",
"text": "Automatic Translation Setting"
"text": "Auto Translation Setting"
},
"submit": {
"type": "plain_text",
Expand Down Expand Up @@ -54,23 +51,23 @@
"text": "Japanese",
"emoji": true
},
"value": "jp"
"value": "JA"
},
{
"text": {
"type": "plain_text",
"text": "English",
"emoji": true
},
"value": "us"
"value": "EN-US"
},
{
"text": {
"type": "plain_text",
"text": "Chinese",
"emoji": true
},
"value": "cn"
"value": "ZH"
}
],
"action_id": "languages-select-action"
Expand All @@ -82,5 +79,26 @@
}
}
]
},
"error_modal_view": {
"type": "modal",
"callback_id": "error_modal",
"title": {
"type": "plain_text",
"text": "Error"
},
"close": {
"type": "plain_text",
"text": "閉じる"
},
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Error"
}
}
]
}
}
Binary file added food_character_konnyaku.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.poetry]
name = "slack_translator_bot"
version = "0.1.0"
description = "slack bot for traslating messages"
authors = ["yutoml <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
deepl = "^1.16.1"
slack-bolt = "^1.18.1"

[tool.poetry.scripts]
start = "slack_translator_bot.main:__main__"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
142 changes: 0 additions & 142 deletions slack-translator-bot/main.py

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 30a9b8d

Please sign in to comment.