https://github.com/n138-kz/oshiire-bot
https://github.com/n138-kz/oshiire-bot
bot discord discord-bot
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/n138-kz/oshiire-bot
- Owner: n138-kz
- License: mit
- Created: 2023-02-28T09:53:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-07T10:31:17.000Z (almost 2 years ago)
- Last Synced: 2024-07-07T11:48:09.537Z (almost 2 years ago)
- Topics: bot, discord, discord-bot
- Language: Python
- Homepage: https://twitter.com/hashtag/%E6%8A%BC%E5%85%A5%E3%82%8C%E9%AF%96?src=hashtag_click
- Size: 99.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# [押入れBOT](https://github.com/n138-kz/oshiire-bot)
[](/../../)
[](/../../)
[](/../../actions)
[](/../../actions)
[](/../../)
[](/../../)
[](/../../)
[](/../../issues)
[](/../../)
[](/../../)
[](/../../)
## How to run
1. Install the Docker [https://docs.docker.jp/docker-for-windows/install.html](https://docs.docker.jp/docker-for-windows/install.html)
1. Get Webhook URI [https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)


1. Create [`secret.yml`](#secretyml-gitignore) file to under `dev/` or `prd/`.
1. Run command the below ([#docker-build](#docker-build))
1. Run command the below ([#docker-run](#docker-run))
## Docker Build
```bash:docker-build
docker build -t n138-kz/oshiire-bot:dev dev/ ;
docker build -t n138-kz/oshiire-bot:prd prd/ ;
docker build -t n138-kz/oshiire-bot prd/ ;
```
## Docker Run
```bash:docker-run
docker run n138-kz/oshiire-bot:dev
```
## Items
- Dockerfile -- Dockerfile
- images_001.png -- 添付画像ファイル
- push.py -- Script本体
- [secret.yml](#secretyml-gitignore) -- Discord API エンドポイント
[](/../../)
### secret.json (gitignore)
```json:secret.json
{
"credential": {
"endpoint": "https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxxxx"
}
}
```
### secret.yml (gitignore)
```yaml:secret.yml
credential:
endpoint: https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxxxx
```
[`?wait=true`][waitEqTrue] : [200OK][http200] の時 Responceを返すようになる。(デフォルトでは付いてない→ [204NoContent][http204]になる)
**なくてもいい**
---
> waits for server confirmation of message send before response (defaults to `true`; when `false` a message that is not saved does not return an error)
[http200]: https://developer.mozilla.org/ja/docs/Web/HTTP/Status/200
[http204]: https://developer.mozilla.org/ja/docs/Web/HTTP/Status/204
[waitEqTrue]: https://discord.com/developers/docs/resources/webhook#execute-webhook
---
```bash
[n138-kz@localhost oshiire-bot]$ date ; ls -lA *
Mon Jul 3 04:26:26 JST 2023
-rw-r--r-- 1 komiya komiya 1067 May 3 12:12 License
-rw-r--r-- 1 komiya komiya 3681 Jun 4 02:40 README.md
dev:
total 1212
-rw-r--r-- 1 komiya komiya 196 May 24 18:41 Dockerfile
-rw-r--r-- 1 komiya komiya 1216787 Jul 3 04:18 images_001.png
-rw-r--r-- 1 komiya komiya 10168 Jul 3 04:18 push.py
-rw-r--r-- 1 komiya komiya 156 Jun 4 19:07 secret.yml
prd:
total 1212
-rw-r--r-- 1 komiya komiya 196 May 24 18:43 Dockerfile
-rw-r--r-- 1 komiya komiya 1216787 Jul 3 04:18 images_001.png
-rw-r--r-- 1 komiya komiya 10199 Jul 3 04:18 push.py
-rw-r--r-- 1 komiya komiya 156 May 3 15:06 secret.yml
[n138-kz@localhost oshiire-bot]$
```
## Refs links
- [Discord Webhooks Guide | Structure of Webhook](https://birdie0.github.io/discord-webhooks-guide/discord_webhook.html)
- [pythonからDiscordのwebhookでメッセージ投稿する備忘録 - Qiita](https://qiita.com/ABBBB/items/e6bdf7fc94b8f6f72a01)
- [(小ネタ)Discord WebhookでTwitterみたいな4枚画像を表示してみる - Qiita](https://qiita.com/GrapeColor/items/bdcf8431b13091447028)
- [Discord Developer Portal — Documentation — Webhook][waitEqTrue]