Skip to content

Commit

Permalink
Railway deployment instructions added in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib authored May 4, 2023
1 parent 7865094 commit 7b9e14b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 29 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
[![hi](https://github-readme-stats.vercel.app/api/pin/?username=5hojib&repo=hk-upstream&theme=react&border_color=61dafb&border_radius=10)](https://github.com/5hojib/hk-upstream)
[![Repository state](https://github-readme-stats.vercel.app/api/pin/?username=5hojib&repo=hk-upstream&theme=react&border_color=61dafb&border_radius=10)](https://github.com/5hojib/hk-upstream)

[![Support Group](https://img.shields.io/badge/Support%20Group-Join-000000)](https://t.me/Luna073xChat) [![Render](https://img.shields.io/badge/Deploy%20to%20Render-Deploy-000000)](https://render.com/deploy?repo=)

<a href="https://render.com/deploy?repo="><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" width="120"></a>

[Support Group](https://t.me/Luna073xChat)
### Instructions for Render
1. Fork and star this repository.
2. Go to your forked repository.
3. Click on 'Deploy to Render' button.
4. Fill in all variables correctly and start the deployment.
5. After deployment, fill in `BASE_URL` using the `bsetting` command from the bot.
6. Fill in the other variables using the `bsetting` command or by writing them in `sample_config.env` and renaming the file to `config.env`.
7. Upload `token.pickle` and other private files using the `bsetting` command from the bot.

Instructions for Render
---------------------
1. Fork and star this repo.
2. Go to your forked repo.
3. Click on Deploy to Render button.
4. Fill all variable correctly.
5. Fill BASE_URL from bsetting.
6. Fill other variable from bsetting or write in sample_config.env and rename to config.env.
7. Upload token.pickle and other private files from bsetting.

<details>
<summary>Bot commands</summary>
### Instructions for Railway
1. Fork and star this repository.
2. Go to your forked repository.
3. Delete `README.md` and `sample_config.env`.
4. Go to your Railway account and start deploy from GitHub repository.
5. Select forked repository and fill in these variables:
* `BOT_TOKEN`
* `OWNER_ID`
* `DATABASE_URL`
* `TELEGRAM_API`
* `TELEGRAM_HASH`
6. After deployment, fill in the other variables using the `bsetting` command from the bot.
7. Upload `token.pickle` and other private files using the `bsetting` command from the bot.

### Bot commands
```
mirror - or /m Mirror
zipmirror - or /zm Mirror and upload as zip
Expand Down Expand Up @@ -54,24 +62,16 @@ stats - Bot Usage Stats
ping - Ping the Bot
help - All cmds with description
```
</details>







### Modified from
* [JMDKH](https://github.com/junedkh/jmdkh-mltb)
* [MLTB](https://github.com/anasty17/mirror-leech-telegram-bot)
* [WZML](https://github.com/weebzone/WZML)


### Thanks To
* [Juned KH](https://github.com/junedkh)
* [Anas](https://github.com/anasty17)
* [Karan Adhikary](https://github.com/weebzone)
* ChatGPT

You can't donate me!
You can't donate me! 🤣
33 changes: 29 additions & 4 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,50 @@ async def stats(client, message):
await sendMessage(message, stats)

async def start(client, message):
token_timeout = config_dict['TOKEN_TIMEOUT']
if len(message.command) > 1:
userid = message.from_user.id
input_token = message.command[1]
if userid not in user_data:
return await sendMessage(message, 'Who are you?')
data = user_data[userid]
if 'token' not in data or data['token'] != input_token:
return await sendMessage(message, 'This is a token already expired')
return await sendMessage(message, 'This token is already expired')
data['token'] = str(uuid4())
data['time'] = time()
user_data[userid].update(data)
return await sendMessage(message, f'Token refreshed successfully!\n\n<b>Valid for:</b> {config_dict["TOKEN_TIMEOUT"]}s')
time_str = format_validity_time(token_timeout)
return await sendMessage(message, f'Congratulations! Token refreshed successfully!\n\n<b>It will expire after</b> {time_str}')
elif config_dict['DM_MODE']:
start_string = f'<b>Welcome, To Era of Luna!</b>\n\nNow I will send your files or links here.\n'
start_string = f'<b>Welcome to the Era of Luna!</b>\n\nNow I will send your files or links here.\n'
else:
start_string = f'<b>Welcome, To Era of Luna!</b>\n\nThis bot can Mirror all your links To Google Drive!\n'
start_string = f'<b>Welcome to the Era of Luna!</b>\n\nThis bot can Mirror all your links To Google Drive!\n'

await sendMessage(message, start_string)

def format_validity_time(validity_time):
days = validity_time // (24 * 3600)
validity_time = validity_time % (24 * 3600)
hours = validity_time // 3600
validity_time %= 3600
minutes = validity_time // 60
validity_time %= 60
seconds = validity_time
time_str = ''
if days > 0:
suffix = 's' if days > 1 else ''
time_str += f"{days} day{suffix} "
if hours > 0:
suffix = 's' if hours > 1 else ''
time_str += f"{hours} hour{suffix} "
if minutes > 0:
suffix = 's' if minutes > 1 else ''
time_str += f"{minutes} minute{suffix} "
suffix = 's' if seconds > 1 else ''
time_str += f"{seconds} second{suffix}"
return time_str


async def restart(client, message):
restart_message = await sendMessage(message, "Restarting...")
if scheduler.running:
Expand Down

0 comments on commit 7b9e14b

Please sign in to comment.