diff --git a/README.md b/README.md index bed6876..ed36df1 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ For Unix users, use the preffered method [here](https://nodejs.org/en/download/) ### MongoDB -You need MongoDB to run this bot, You can get a free deployment from [mongolab](https://mlab.com). Follow the instructions below: +You need MongoDB to run this bot, You can get a free deployment from [mongolab](https://mlab.com). Follow the instructions below (skip if deploying to Openshift): @@ -152,6 +152,33 @@ $ npm install -g forever $ forever start bot.js ``` +### Openshift + + + +```bash +# Ensure You Have Node.JS Installed! +$ node -v + +# Clone The Repo +$ git clone https://github.com/kamikazechaser/ThorsHammer.git -b openshift +$ cd ThorsHammer +# Ensure all fields in core/config.js are present! Except the MONGODB_URL, leave it as is! + +# Log into your Openshift web console +# Create a new app +# Select Node.js [Latest] +# Launch the app +# Add a cartridge > Install your own cartridge +# Enter this => https://raw.githubusercontent.com/icflorescu/openshift-cartridge-mongodb/master/metadata/manifest.yml +# Add your ssh keys to Openshift and ensure they are available in $HOME/.ssh locally +# Copy your git address from the side, on the web console + +$ git remote add openshift [REMOTE GIT ADDRESS, COPIED FROM ABOVE] +$ git push openshift master --force + +``` + *Other Strategies* You can modify `core/telegram.js` to implement your own strategy, such as clustering or websockets. @@ -165,15 +192,15 @@ Star and Fork the repository and submit a pull request for whatever change you w Translations are welcome. Languages given priority are: -- ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol +- ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol - Translated by [@keijodputt](https://github.com/keijodputt) - ๐Ÿ‡ง๐Ÿ‡ท Portuguรชs - ๐Ÿ‡ฎ๐Ÿ‡ท Farsi -- ๐Ÿ‡ธ๐Ÿ‡ฆ Arabic +- ๐Ÿ‡ธ๐Ÿ‡ฆ Arabic - Translated by [@rix4r](https://github.com/claydev) - [full arabic fork](https://github.com/claydev/ThorsHammer) - ๐Ÿ‡ฎ๐Ÿ‡น Italiano +- ๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia - Transalted by [@rizaumami](https://github.com/rizaumami) - [full bahasa indonesia fork](https://github.com/rizaumami/TGramIndoBot) Edit the respective fields in `core/locale.json` and submit a pull request. be careful of Markdown elements and `\n`, they are important! ## License Released under AGPL-v3.0, see the [LICENSE](https://github.com/kamikazechaser/ThorsHammer/blob/master/LICENSE) file. - diff --git a/controllers/menu.js b/controllers/menu.js index 4824812..36478ed 100644 --- a/controllers/menu.js +++ b/controllers/menu.js @@ -21,6 +21,9 @@ const helpKeyboard = [[{ }, { text: `๐Ÿ‡ฎ๐Ÿ‡น Italiano`, callback_data: `help_it` +}, { + text: `๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia`, + callback_data: `help_id` }]] const inlineKeyboard = [[{ @@ -41,6 +44,9 @@ const inlineKeyboard = [[{ }, { text: `๐Ÿ‡ฎ๐Ÿ‡น Italiano`, switch_inline_query_current_chat: `help it` +}, { + text: `๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia`, + switch_inline_query_current_chat: `help id` }]] bot.onText(/^[\/!#]start$/, msg => { @@ -84,10 +90,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `help_${langCode}`) { bot.editMessageText(`${lang.start}`, { @@ -145,10 +154,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `banhammer_help_${langCode}`) { bot.editMessageText(`${lang.banhammerinfo}`, { @@ -175,7 +187,7 @@ bot.on('callback_query', msg => { }]] } }) - } + } }); bot.on('callback_query', msg => { @@ -201,10 +213,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `globaladmin_help_${langCode}`) { bot.editMessageText(`${lang.globaladmininfo}`, { @@ -218,7 +233,7 @@ bot.on('callback_query', msg => { }]] } }) - } + } }); bot.on('callback_query', msg => { @@ -244,10 +259,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `ingroup_help_${langCode}`) { bot.editMessageText(`${lang.ingroupinfo}`, { @@ -300,10 +318,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `about_help_${langCode}`) { bot.editMessageText(`${lang.aboutinfo}`, { @@ -317,7 +338,7 @@ bot.on('callback_query', msg => { }]] } }) - } + } }); bot.on('callback_query', msg => { @@ -346,7 +367,10 @@ bot.on('callback_query', msg => { } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `banhammer_help_${langCode}`) { bot.editMessageText(`${lang.banhammerinfo}`, { @@ -400,10 +424,13 @@ bot.on('callback_query', msg => { } if (lang == `ar`) { lang = locale.ar - } + } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } bot.answerCallbackQuery(msg.id, `๐Ÿ‘`); if (msg.data == `recycle_help_${langCode}`) { bot.editMessageText(`*Help Menu*`, { @@ -464,7 +491,10 @@ bot.on('inline_query', function(msg) { } if (lang == `it`) { lang = locale.it - } + } + if (lang == `id`) { + lang = locale.id + } let opts = []; if (msg.query == `help ${langCode}`) { opts = [ @@ -507,7 +537,7 @@ bot.on('inline_query', function(msg) { message_text: lang.aboutinfo, parse_mode: `Markdown`, thumb_url: `http://emojipedia-us.s3.amazonaws.com/cache/a3/88/a3881d9895bfa74d5f8c6acea0953c3d.png` - + }, { type: `article`, @@ -516,7 +546,7 @@ bot.on('inline_query', function(msg) { message_text: lang.creditsinfo, parse_mode: `Markdown`, thumb_url: `http://emojipedia-us.s3.amazonaws.com/cache/51/5b/515b0cff9d179c6b7fa14d5ee54deebb.png` - } + } ] } else { @@ -535,4 +565,4 @@ bot.on('inline_query', function(msg) { ] } bot.answerInlineQuery(msg.id, opts); -}); \ No newline at end of file +}); diff --git a/core/locale.json b/core/locale.json index 36dd39c..c23906b 100644 --- a/core/locale.json +++ b/core/locale.json @@ -88,5 +88,20 @@ "ingroupinfo": "Coming Soon!", "aboutinfo": "Coming Soon!", "creditsinfo": "Coming Soon!" + }, + "id": { + "start": "*Pengenalan\n\n*ThorsHammer adalah sebuah bot moderasi sederhana yang melengkapi _Group Butler/GroupThor_. Siapapun dapat menggunakan bot ini di dalam grupnya untuk mengerjakan tugas sederhana seperti:\n1๏ธโƒฃ๏ธ _Kick_ dan _Ban_\n*dan yang terpenting*,\n2๏ธโƒฃ๏ธ Mencegah para _spammer_, yang telah di_ban_ secara global, agar tidak masuk ke dalam grup!\n\nUntuk memulai, jadikan bot ini sebagai administrator grup.\n\nUntuk keterangan lebih lanjut, gunakan perintah /help.\n\n*Menu Bantuan*\n\n๐Ÿ’ก Saran: Gunakan _Inline Mode_!\n\nDalam grup, ketik `@thorshammerbot` kemudian spasi diikuti perintah.", + "banhammer_help": "Banhammer", + "superuser_help": "Superuser", + "globaladmin_help": "Admin Global", + "ingroup_help": "Dalam Grup", + "about_help": "Tentang", + "credits_help": "Kredit", + "banhammerinfo": "*Perintah Banhammer*\n\nAwali perintah dengan `/`, `!`, atau `#`\n\nโ€ข `/hammer [menggunakan reply|username|id]`: _ban user_ secara global dari seluruh grup.\nโ€ข `/unhammer [menggunakan reply|username|id]`: _unban user_ secara global dari seluruh grup.", + "superuserinfo": "*Perintah Superuser*\n\nAwali perintah dengan `/`, `!`, atau `#`\n\nโ€ข `/promote [menggunakan reply|username|id]`: angkat _user_ menjadi admin global.\nโ€ข `/demote [menggunakan reply|username|id]`: turunkan _user_ dari jabatan admin global.", + "globaladmininfo": "*Perintah Admin Global*\n\nAwali perintah dengan `/`, `!`, atau `#`\n\nAdmin global dapat sepenuhnya menggunakan banhammer, seorang admin global hanya bisa diangkat oleh _superuser_.\n\nโ€ข `/banlist`: kirim daftar _ban_ ke kanal _log_ (pencatat).", + "ingroupinfo": "*Perintah dalam grup*\n\nAwali perintah dengan `/`, `!`, atau `#`\n\nโ€ข `/kick [menggunakan reply]`: keluarkan _user_ dari grup.\nโ€ข `/ban [menggunakan reply]`: _ban user_ dari grup.\nโ€ข `/admins`: daftar administrator grup.\nโ€ข `/globaladmins`: daftar admin global yang dapat menggunakan banhammer.", + "aboutinfo": "*Keterangan*\n\n_Lisensi:_ AGPL-v3.0\n_Ditulis oleh:_ @kamikazechaser\n_Kode sumber:_ [ThorsHammer](https://github.com/kamikazechaser/ThorsHammer)", + "creditsinfo": "*Penerjemah*\n\n๐Ÿ‡ช๐Ÿ‡ธ - {Insert Name Here}\n๐Ÿ‡ง๐Ÿ‡ท - {Insert Name Here}\n๐Ÿ‡ฎ๐Ÿ‡ท - {Insert Name Here}\n๐Ÿ‡ธ๐Ÿ‡ฆ - {Insert Name Here}\n๐Ÿ‡ฎ๐Ÿ‡น - {Insert Name Here}\n๐Ÿ‡ฎ๐Ÿ‡ฉ - Sahri Riza Umami" } -} \ No newline at end of file +} diff --git a/core/telegram.js b/core/telegram.js index cb3f84b..12bf424 100644 --- a/core/telegram.js +++ b/core/telegram.js @@ -14,4 +14,4 @@ bot.getMe().then(me => { bot.sendMessage(config.SUDO, `Bot Started!\n${moment().format('MMMM Do YYYY, h:mm:ss a')}`, {parse_mode: 'Markdown'}); }); -module.exports = bot; \ No newline at end of file +module.exports = bot;