Skip to content

Commit

Permalink
Add Timezon config
Browse files Browse the repository at this point in the history
Signed-off-by: breakdowns <[email protected]>
  • Loading branch information
Hafitz Setya authored Jul 18, 2021
1 parent c884bda commit 45eec69
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tgx, yts, eztv, torlock, rarbg
letsupload.io, hxfile.co, anonfiles.com, bayfiles.com, antfiles,
fembed.com, fembed.net, femax20.com, layarkacaxxi.icu, fcdn.stream,
sbplay.org, naniplay.com, naniplay.nanime.in, naniplay.nanime.biz, sbembed.com,
streamtape.com, streamsb.net, feurl.com, pixeldrain.com,
streamtape.com, streamsb.net, feurl.com, pixeldrain.com, racaty.net,
1drv.ms (Only works for file not folder or business account),
uptobox.com (Uptobox account must be premium)
```
Expand Down Expand Up @@ -167,6 +167,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **MEGA_LIMIT**: To limit downloading Mega (leave space between number and unit, Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB```
- **TORRENT_DIRECT_LIMIT**: To limit the Torrent/Direct mirror size, Leave space between number and unit. Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB```
- **TAR_UNZIP_LIMIT**: To limit mirroring as Tar or unzipmirror. Available units is (gb or GB, tb or TB), Examples: ```100 gb, 100 GB, 10 tb, 10 TB```
- **TIMEZONE**: To change time zone in ```/stats``` command (**NOTE**: Default time zone using ```Asia/Jakarta```)
- **IMAGE_URL**: Show Image/Logo in /start message. Fill value of image your link image, use telegra.ph or any direct link image.
- **VIEW_LINK**: View Link button to open file Index Link in browser instead of direct download link, you can figure out if it's compatible with your Index code or not, open any video from you Index and check if the END of link from browser link bar is `?a=view`, if yes make it `True` it will work (Compatible with [Bhadoo Index](https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index) Code)
- **UPTOBOX_TOKEN**: Uptobox token to mirror uptobox links. Get it from [Uptobox Premium Account](https://uptobox.com/my_account).
Expand Down
5 changes: 5 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
"description": "Fill your shortener api key if you are using shortener.",
"required": false
},
"TIMEZONE": {
"description": "To change time zone in /stats command.",
"value": "Asia/Jakarta",
"required": false
},
"IMAGE_URL": {
"description": "Show Image/Logo in /start message, Use telegra.ph or any direct link image.",
"value": "https://telegra.ph/file/db03910496f06094f1f7a.jpg",
Expand Down
7 changes: 7 additions & 0 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ def mktable():
UNFINISHED_PROGRESS_STR = '○'
except KeyError:
UNFINISHED_PROGRESS_STR = '○'
try:
TIMEZONE = getConfig('TIMEZONE')
if len(TIMEZONE) == 0:
TIMEZONE = 'Asia/Jakarta'
except KeyError:
TIMEZONE = 'Asia/Jakarta'

updater = tg.Updater(token=BOT_TOKEN)
bot = updater.bot
dispatcher = updater.dispatcher
5 changes: 2 additions & 3 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@

from telegram import ParseMode
from telegram.ext import CommandHandler
from bot import bot, dispatcher, updater, botStartTime, IMAGE_URL, IGNORE_PENDING_REQUESTS
from bot import bot, dispatcher, updater, botStartTime, IMAGE_URL, IGNORE_PENDING_REQUESTS, TIMEZONE
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.message_utils import *
from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time
from .helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper import button_build
from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, torrent_search, delete, speedtest, usage, mediainfo, count, config, updates

now=datetime.now(pytz.timezone('Asia/Jakarta'))
now=datetime.now(pytz.timezone(f'{TIMEZONE}'))


def stats(update, context):
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async def config_button(_, query):
elif data == '9':
return await query.message.edit(
__header__.format(data)
+ f"**[ Others Config ]**\n\n**VIEW_LINK:** `{VIEW_LINK}`\n\n**STATUS_LIMIT:** `{STATUS_LIMIT}`\n\n**DOWNLOAD_STATUS_UPDATE_INTERVAL:** `{DOWNLOAD_STATUS_UPDATE_INTERVAL}`\n\n**IGNORE_PENDING_REQUESTS:** `{IGNORE_PENDING_REQUESTS}`\n\n**AUTO_DELETE_MESSAGE_DURATION:** `{AUTO_DELETE_MESSAGE_DURATION}`\n\n**DOWNLOAD_DIR:** `{DOWNLOAD_DIR}`\n\n**IMAGE_URL:** `{IMAGE_URL}`\n\n**DATABASE_URL:** `{DB_URI}`",
+ f"**[ Others Config ]**\n\n**VIEW_LINK:** `{VIEW_LINK}`\n\n**STATUS_LIMIT:** `{STATUS_LIMIT}`\n\n**TIMEZONE:** `{TIMEZONE}`\n\n**DOWNLOAD_STATUS_UPDATE_INTERVAL:** `{DOWNLOAD_STATUS_UPDATE_INTERVAL}`\n\n**IGNORE_PENDING_REQUESTS:** `{IGNORE_PENDING_REQUESTS}`\n\n**AUTO_DELETE_MESSAGE_DURATION:** `{AUTO_DELETE_MESSAGE_DURATION}`\n\n**DOWNLOAD_DIR:** `{DOWNLOAD_DIR}`\n\n**IMAGE_URL:** `{IMAGE_URL}`\n\n**DATABASE_URL:** `{DB_URI}`",
reply_markup=types.InlineKeyboardMarkup(
[
[
Expand Down
1 change: 1 addition & 0 deletions config_sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ STOP_DUPLICATE_CLONE = ""
STOP_DUPLICATE_MEGA = ""
SHORTENER = ""
SHORTENER_API = ""
TIMEZONE = "Asia/Jakarta"
IMAGE_URL = "https://telegra.ph/file/db03910496f06094f1f7a.jpg"
# If you want to use Credentials externally from Index Links, fill these vars with the direct links
# These are optional, if you don't know, simply leave them, don't fill anything in them.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aiohttp
aria2p
appdirs
beautifulsoup4
cloudscrape==0.4.2
cloudscrape
feedparser
gitpython
google-api-python-client
Expand Down

0 comments on commit 45eec69

Please sign in to comment.