{"id":24923271,"url":"https://github.com/doarakko/yattoite","last_synced_at":"2026-05-04T02:33:22.449Z","repository":{"id":45212593,"uuid":"432479301","full_name":"Doarakko/yattoite","owner":"Doarakko","description":"Slack bot that responds on my behalf on holidays using freee人事労務","archived":false,"fork":false,"pushed_at":"2026-05-02T13:59:21.000Z","size":206,"stargazers_count":0,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-02T15:34:30.752Z","etag":null,"topics":["bot","freee","markov-chain","slack","slack-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Doarakko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"Doarakko"}},"created_at":"2021-11-27T14:14:15.000Z","updated_at":"2022-01-10T10:14:45.000Z","dependencies_parsed_at":"2022-08-30T08:30:29.675Z","dependency_job_id":null,"html_url":"https://github.com/Doarakko/yattoite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Doarakko/yattoite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doarakko%2Fyattoite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doarakko%2Fyattoite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doarakko%2Fyattoite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doarakko%2Fyattoite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Doarakko","download_url":"https://codeload.github.com/Doarakko/yattoite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doarakko%2Fyattoite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32592510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","freee","markov-chain","slack","slack-bot"],"created_at":"2025-02-02T11:37:15.104Z","updated_at":"2026-05-04T02:33:22.433Z","avatar_url":"https://github.com/Doarakko.png","language":"Python","funding_links":["https://github.com/sponsors/Doarakko"],"categories":[],"sub_categories":[],"readme":"# yattoite\n\nSlack bot that responds on my behalf on holidays using [freee 人事労務](https://www.freee.co.jp/hr).\n\n![example](./example.png)\n\nThis bot is created using Slack past messages and markov chain.\n\nYou can also use a CSV file instead of Slack comments.\n\n## Requirements\n\n- Slack\n- freee API\n- Docker\n- docker-compose\n- Heroku\n  - Not required if run on local\n- CSV file\n  - Not required if use Slack comments\n\n### Expected CSV format\n\n| id  | body                                       |\n| :-- | :----------------------------------------- |\n| 1   | 私は天才エンジニアです。                   |\n| 2   | お腹空き空き空き空き空きっ腹。寿司食うぞ。 |\n| ... | ...                                        |\n\n## Usage\n\n### 1. Prepare code and create `.env` file\n\n```sh\ngit clone https://github.com/Doarakko/yattoite\ncd yattoite\ncp .env.example .env\n```\n\n### 2. Create Slack app and enter environmental varialbes to `.env`\n\nEasy to create using `manifest.yml`.\n\nGet App-Level Token(`xapp-aaaa`) with `connections:write` and Bot User OAuth Token(`xoxb-bbbb`).\n\n```\nSLACK_APP_TOKEN=xapp-aaaa\nSLACK_BOT_TOKEN=xoxb-bbbb\nSLACK_USER_ID=ABCD01234\n```\n\nGet your user id on Slack by tapping your account and pressing \"Copy link\".\n\n### 3. Create freee App\n\n```\nFREEE_CLIENT_ID=cccc\nFREEE_CLIENT_SECRET=dddd\nFREEE_CODE=eeee\n```\n\nFor FREEE_CODE, enter the \"認可コード\" obtained by accessing the \"Web アプリ認証用 URL\" on the browser.\n\n### 4. Get Slack comments\n\n```sh\ndocker-compose up\ndocker exec -it app python scripts/create_table.py\n```\n\n`q` specifies the name of the channels from which to get the comments.\n\nAll channels containing `q` are included.\nIf you specify `times`, you can get it from `*times*`.\n\n```sh\ndocker exec -it app python scripts/1_save_slack_comments.py \u003cquery\u003e\n```\n\nChoose a user to create a bot.\nUser id is like `U0123abcd`.\n\n```sh\ndocker exec -it app python scripts/2_select_slack_user.py \u003cuser id\u003e\n```\n\nIf you use the CSV file you have already prepared, skip it.\n\n### 5. Preprocessing and make text file\n\nYou can specify the input and output file path by specifying the `-i` and `-o` options.(optional)\n\n```sh\ndocker exec -it app python scripts/3_preprocessing.py -i data/\u003cuser id\u003e_comments.csv\n```\n\nYou can use `-min` and `-max` options to limit the size of the sentence you use.(optional)\n\nIf the `-min` is 6, then `我々4歳くらいです`(`我々 4 歳 くらい です`) is excluded.\n\n```sh\ndocker exec -it app python scripts/4_make_sentences.py -i \u003cinput\u003e -o \u003coutput\u003e -min \u003cminimum word count\u003e -max \u003cmax word count\u003e\n```\n\n### 6. Generate sentences\n\nYou can use `-s` to specify how many morphemes of the original sentence to use.\n\nLarger will produce the correct sentece, but it's boring.\n\n```sh\ndocker exec -it app python scripts/5_generate.py -i \u003cinput\u003e -o \u003coutput\u003e -n \u003ccount of generate sentences\u003e -s \u003cstate size\u003e\n```\n\nLet's enjoy tuning!\n\n### 7. Insert records\n\n```sh\ndocker exec -it app python scripts/6_insert.py\n```\n\n## Run on Heroku\n\nClick \"Deploy to Heroku\" Button and enter your environment valiables.\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\nGet `DATABASE_URL` from \"Settings/Config Vars\" on Heroku dashboard.\n\nOn local enter the `DATABASE_URL`, other data create and insert methods are the same as the above local step.\n\n## Hints\n\n### Bot does not respond when you are working\n\n```python\ndef message(message):\n    ...\n\n    if freee.is_working():\n        return\n\n    ...\n    client.chat_postMessage(channel=message[\"channel\"], text=row.body)\n```\n\n### Make a rug without getting an immediate response\n\n```python\ndef message(say):\n    ...\n\n    # camouflage to avoid being identified as a bot\n    time.sleep(\n        random.choices(\n            [10, 20, 30, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600],\n            [3, 3, 3, 5, 5, 5, 3, 3, 1, 1, 1, 1, 1],\n        )[0]\n    )\n\n    ...\n```\n\n### Make your bot's icon and name the same as your Slack account\n\nIf you look closely, it will be noticed if it is a bot depending on whether or not \"App\" is displayed.\n\nWell, it'll be alright.\n\n![example 1](./example1.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoarakko%2Fyattoite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoarakko%2Fyattoite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoarakko%2Fyattoite/lists"}