Lunski's Clutter

This is a place to put my clutters, no matter you like it or not, welcome here.

0%

自動化

5

Do you remember we have mentioned IFTTT in Android Skill? Automate repetitive things can make life more convenient.
This article shows the publication of the article to the promotion process.

還記得Android小技巧提到的IFTTT嗎?自動化重複的事可以為生活帶來便利,這篇來說明整個部落格發文到推廣的流程。

Self-produced

IG: Shvara uploads cute panda pictures.
Blog: Lunski use MacDown and deploy articles to Github by Hexo.
Pixnet: Lunski write articles on Pixnet.

Direct delivery

The first thing we need to know, IFTTT「if this then that」 is a web service. Like Observer Pattern in design patterns, there will feedback when the conditions were met.
There is a similar service, Zapier. I use it in those way:

首先要先知道 IFTTT「if this then that」是一個網路服務,像監聽者模式,在條件觸發時產生反饋,同類型的服務還有 Zapier,我用的場域有:

IFTTT

Zapier

Cloudflare CDN

1
npm install -g hexo; hexo clean; hexo generate

https://eric999j-github-io.pages.dev/

Self-monitoring

Google APPs Script
Line Notify

After APPs Script setting, it will check website’s HTTP status code is 200 OK periodically, if it isn’t 200, there is a message in Line Notify chat room.

Google APPs Script
Line Notify

透過APPs Script設定,週期確認小圈圈網站有回200 ok,有異常會在Line Notify聊天室通知

Self-selling

Telegram: Lunski’s Circle
FB:Lunski’s Circle
LinkTree: Lunski

LinkTree

A hightlght of my blog system, just like Facade Pattern.

Shvara Bot

robotShvara
A bot in Telegram, it has those instructions.
  • When bot in a chanel or group only provides:
    • hi: reply “hi”
    • shvara: Randomly speak a Japanese sentence of Shvara on each call.

Shvara API

ShvaraAPI : Source code of /shvara instruction, deployed on Vercel.

Kanji to Hiragana function

To know kanji’s hiragana is helpful for Japanese learner, so we made it!

Dockerize

The backend of this bot is execute $ node bot.js in a linux system. However, if we didn’t do dockerize, we will forgot how to setup the environment next time. So I decide to dockerize it.

All depedency wrote in a dockerfile. Generally, we need to upload this file to DockerHub, and host in Heroku, but it contains some private information, so I put in private Github repository. If I have approate linux environment, I can pull and execute $ docker run node-docker to build to docker image.

這個Bot後端是在一個linux系統下$ node bot.js,可是所有相依都要在電腦裝好,下次也會忘記怎麼設定,所以我決定把這個nodejs app包成Docker。

相依套件都寫在dockerfile,一般來說直接上傳DockerHub,host在Heroku會更方便,但專案有機密資訊就改成放private Github repository,有linux環境再抓下來在系統下$ docker run node-docker build image。

這樣只要有適合環境就能再重現出我們的後端囉。

1
2
3
4
5
6
$ docker build --tag node-docker .
$ docker images # 47a0ef2fc28d
$ docker run node-docker # 就會在docker裡執行 node bot.js

# Next time we need to run.
$ docker start 47a0ef2fc28d

Chatfuel

Chatfuel is a platform to construct bot in Facebook group easily. Different from Shvara is a panda who loves Japanese. Lunski is a engineer, so I use TechCrunch bot, it’s convenient for me and group users.

Chatfuel是一個Facebook社團方便的機器人建造平台,不同於Shvara是隻愛日文的貓熊,Lunski的定位在工程師,那就串個TechCrunch Headlines自己用著也方便。

結語

All setting are easy, after those setting, Lunski only need to focus on post articles, and Shvara only need to acting cute. Everything looks good, isn’t it?

設定都很簡單,之後我只需要專注在部落格發文,貓熊只需要賣萌就可以了,是不是很方便呢?


如果你覺得這篇文章很棒,請你不吝點讚 (゚∀゚)

Welcome to my other publishing channels