command
module
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Feb 11, 2024
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
kuchihira-bot
ja: 「中村繪里子・吉田尚記の本格雑談くちをひらく」の更新通知を Twitter (@kuchihira_bot, 公黙認) と Bluesky (@kuchihira-bot.bsky.social, 非公式)に投稿するBotプログラム
en: A bot program that posts "中村繪里子・吉田尚記の本格雑談くちをひらく" update notifications to Twitter (@kuchihira_bot, semi-official) and Bluesky (@kuchihira-bot.bsky.social, unofficial)
setup
-
git clone or go install
git clone https://github.com/mikuta0407/kuchihira-bot.git
cd kuchihira-bot
go build .
or
mkdir kuchihira-bot
cd kuchihira-bot
go install github.com/mikuta0407/kuchihira-bot@latest
-
make config directory
mkdir ./_config
-
create _config/config-discord.json
{
"username":"くちをひらくBot",
"avatar_url":"",
"url":"https://discord.com/api/webhooks/..."
}
-
create _config/config-twtr.json
{
"apikey":"hogeApiKey",
"apikeysec":"hogeApiKeySecet",
"oauthtoken":"hogeOAuthToken",
"oauthtokensec":"hogeOAuthTokenSecret"
}
-
create _config/kuchihira/json
{
"hashtag":"#くちをひらく",
"rss":"https://www.omnycontent.com/d/playlist/67122501-9b17-4d77-84bd-a93d00dc791e/bf2b4e95-c669-4e1c-abcf-a98c00a5f513/b923e360-dc05-438d-be85-a98c00a5f517/podcast.rss",
"omnyfm":"https://omny.fm/shows/kuchiwohiraku/",
"voicy":"https://voicy.jp/channel/584",
"mentions":[
"@yoshidahisanori",
"@eriko_co_log",
"@kuchiwohiraku"
]
}
-
generate _config/config-bsky.json
./kuchihira-bot login -u handle.example.net -p yourpassword -s host(optional)
config-bsky.json is generated in _config.
Auth data is generated by first post in _config/<handle>.auth
usage
./kuchihira-bot post
cron example
Episode updates are usually done between 17:00 (JST) and 17:02 (JST), so start fetching RSS updates every 20 seconds starting at 16:50 (JST).
50 16 * * * ~/projects/kuchihira-bot/kuchihira-bot post
Licence
MIT
Note
Digression(余談)
-
元々、 https://gist.github.com/mikuta0407/955808cff9eb725a313a17286c43b558 でも公開しているPHP製プログラムとして2023年5月から稼働させていました。Bluesky投稿を勝手に実装してみるにあたり、PHPでBlueskyのリンク付き投稿の実装がかなり辛かったため、既にmattn氏によって作られていたリンク付き投稿のコードを利用するために、Goを用いて最初から作り直してみました。
正直なところ、行数は増え、cobraによるCLIコマンドを(blueskyログインのためだけに)足したため、プログラムの規模に対して内容が過剰になってしまいました。
書き直したメリットとしては、
- Goによってシングルバイナリになったこと
- すべての変数を外に出したこと(PHPで作ったときは(面倒くさくて)ハードコーディングしていた部分を外に出しながら作った)
- templatesを使ってパワーな文字列結合をしなくなったこと
くらいでしょうか。
このプログラムは利用者が作者自身しかいない気がしますが、一応制作物としてここに置いておきいます。くちをひらかーの皆様、もしツッコミどころや鉞組があればお待ちしています。
Documentation
¶
Copyright © 2024 mikuta0407
Source Files
¶
Directories
¶
|
|
|
internal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.