-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,78 @@ | ||
openwrt-twitterbot | ||
================== | ||
#openwrt-twitterbot | ||
A collection of bash script used on my OpenWRT-based router for generating twitter status, and then post the status to twitter using python twitter tools (PTT). | ||
|
||
A collection of bash script used on my OpenWRT-based router for generating twitter status posted by python twitter tools (PTT). | ||
The bot's twitter account: [@gojibox](https://twitter.com/gojibox) | ||
|
||
Koleksi script bash yang digunakan pada router OpenWRT saya untuk membuat status twitter yang kemudian dikirimkan oleh PTT. | ||
*Koleksi script bash yang digunakan pada router OpenWRT saya untuk membuat status twitter yang kemudian diposting ke twitter menggunakan PTT.* | ||
|
||
####Dependency | ||
Python Twitter Tools (https://github.com/sixohsix/twitter) must be installed properly authorized | ||
##Dependency | ||
You need to install bash on your awesome OpenWRT powered router, as this script mainly written in bash. And some other additional package like curl and wget. | ||
|
||
PTT harus sudah terinstall dan di *authorize* dengan benar | ||
opkg install bash curl wget sed | ||
|
||
####Check twit.py first! | ||
Input your app's *consumerKey*, *consumerSecret*, your *accessToken*, *accessTokenSecret* and your bot username to this script, and you're ready to go! | ||
To use PTT, you need to install Python Twitter Tools (https://github.com/sixohsix/twitter) first. | ||
|
||
Masukan token, key dan username bot di twit.py | ||
easy_install twitter | ||
|
||
####Script Structure | ||
The main script is *tweet.sh*, basically what it does is to randomly choose available/enabled plugins, the chosen plugin then generate status text, and then tweet.sh posted it to twitter through twit.py | ||
You will also need to create an app account on https://dev.twitter.com/apps | ||
|
||
Script utamanya adalah *tweet.sh*, yang dilakukan script ini sebenarnya hanya memilih plugin yang di-enable, plugin tersebut lalu membuat teks status, kemudian tweet.sh mengirimkannya ke twitter lewat script twit.py | ||
1. Sign in with your Twitter account | ||
2. Create a new app account | ||
3. Modify the settings for that app account to allow read & write | ||
4. Generate a new OAuth token with those permissions | ||
5. Put those tokens in the **twit.py** script | ||
|
||
ruwet ya? :D | ||
Then you need to copy twit.py script to ` /usr/bin/twit ` and give it executable permission so we can run it globally by calling ` twit ` command: | ||
|
||
cp twit.py /usr/bin/twit | ||
chmod +x /usr/bin/twit | ||
|
||
####Plugins | ||
Various plugins available, check on "plugin" folder. | ||
*Install PTT > Buat App > Generate OAuth Token > Masukan token dan key di script __twit.py__ > lalu copy twit.py ke /usr/bin/twit > beri permission* | ||
|
||
Ada macem-macem plugin, periksa satu-satu di folder "plugin". | ||
Test the setup, try to post some tweet: | ||
|
||
####How to directly call a particular plugin | ||
Run ` tweet.sh [plugin_name] [parameter]`. The *plugin_name* is the content of ` aksi_array ` on each plugin. | ||
twit -s "hello world!" | ||
|
||
Jalankan ` tweet.sh [plugin_name] [parameter]`. *plugin_name* adalah isi dari ` aksi_array ` di masing-masing script plugin. | ||
If tweet sent succesfully, then everything should be working fine :smile: | ||
|
||
##Script Structure | ||
The main script is ` tweet.sh `, basically what it does is to randomly select available/enabled plugins, the selected plugin then generate status text (or doing something else), and then tweet.sh posted it to twitter through twit.py | ||
|
||
*Script utamanya adalah ` tweet.sh `, yang dilakukan script ini sebenarnya hanya memilih secara acak plugin yang di-enable, plugin tersebut lalu membuat teks status, kemudian tweet.sh mengirimkannya ke twitter lewat script twit.py* | ||
|
||
*ruwet ya? :smile:* | ||
|
||
####How to run script? | ||
By running the main script, try to run multiple time and it should display different output on each run (because the random selection of plugin) | ||
|
||
./tweet.sh | ||
|
||
*Dengan menjalankan script utama, coba jalankan beberapa kali. Script akan menampilkan output berbeda setiap kali dijalankan (karena plugin yang dipilih secara acak)* | ||
|
||
##Plugins | ||
Various plugins available, check on "plugin" folder. You can create your own plugin by following the guide written on ` plugin/1_template.sh ` file. | ||
|
||
*Ada bermacam-macam plugin, periksa di folder "plugin". Anda bisa membuat plugin sendiri dengan mengikuti panduan yang tertulis di file ` plugin/1_template.sh `* | ||
|
||
####How to disable / enable plugin? | ||
The term *disable* or *enable* here is actually means *to include or not to include* a plugin on random selection process by main script (tweet.sh). You can exclude a plugin by commenting this line on each plugin: | ||
|
||
# aksi_array+=("twit_xxxx") | ||
|
||
By doing that, that particular plugin won't be executed when running the main script. | ||
|
||
*Maksud dari enable dan disable di sini sebenarnya adalah menyertakan atau tidak menyertakan sebuah plugin pada proses pemilihan secara acak oleh script utama. Untuk tidak menyertakan sebuah plugin, beri koemntar pada baris tersebut.* | ||
|
||
####How to run / execute disabled plugin? | ||
A disabled plugin still can be executed by directly calling its name as main script's parameter. Assuming that you have disabled ` twit_xxxx ` plugin from before, you can call it like this: | ||
|
||
./tweet.sh twit_xxxx | ||
|
||
And that plugin will be executed despite being disabled. You can do this if you want to override the random selection process in main script or if you want to call a particular plugin. | ||
|
||
*Plugin yang didisable masih bisa dijalankan dengan memanggilnya nama plugin sebagai parameter script utama. Anda bisa menggunakan cara ini untuk memanggil plugin tertentu secara langsung / melewati proses seleksi acak.* | ||
|
||
##Berkontribusi | ||
*Saya yakin masih banyak terdapat bug di project ini, selain hanya dicoba di router pribadi, dalam proses pembuatannya juga tidak terdokumentasi dengan baik. Silahkan fork, oprek dan kirim pull request. Laporkan bug atau eror di tab [issue](https://github.com/gojigeje/openwrt-twitterbot/issues).* | ||
|
||
*Atau diskusikan dengan saya di twitter saya [@gojigeje](https://twitter.com/gojigeje), terima kasih :smile:* |
File renamed without changes.