Skip to content

Openshift #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

<img src="http://i.imgur.com/2h426nA.png" width="200">

Expand Down Expand Up @@ -152,6 +152,33 @@ $ npm install -g forever
$ forever start bot.js
```

### Openshift

<img src="http://www.opencloudconf.com/images/openshift_logo.png" width="200">

```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://github.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.
Expand All @@ -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.

70 changes: 50 additions & 20 deletions controllers/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const helpKeyboard = [[{
}, {
text: `🇮🇹 Italiano`,
callback_data: `help_it`
}, {
text: `🇮🇩 Bahasa Indonesia`,
callback_data: `help_id`
}]]

const inlineKeyboard = [[{
Expand All @@ -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 => {
Expand Down Expand Up @@ -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}`, {
Expand Down Expand Up @@ -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}`, {
Expand All @@ -175,7 +187,7 @@ bot.on('callback_query', msg => {
}]]
}
})
}
}
});

bot.on('callback_query', msg => {
Expand All @@ -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}`, {
Expand All @@ -218,7 +233,7 @@ bot.on('callback_query', msg => {
}]]
}
})
}
}
});

bot.on('callback_query', msg => {
Expand All @@ -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}`, {
Expand Down Expand Up @@ -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}`, {
Expand All @@ -317,7 +338,7 @@ bot.on('callback_query', msg => {
}]]
}
})
}
}
});

bot.on('callback_query', msg => {
Expand Down Expand Up @@ -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}`, {
Expand Down Expand Up @@ -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*`, {
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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`,
Expand All @@ -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 {
Expand All @@ -535,4 +565,4 @@ bot.on('inline_query', function(msg) {
]
}
bot.answerInlineQuery(msg.id, opts);
});
});
17 changes: 16 additions & 1 deletion core/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion core/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
module.exports = bot;