# ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
# ⠿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠛⠛⠛⠛⠛
# ⣶⣦⣤⣤⣤⣤⣤⣤⣬⣭⣭⣍⣉⡙⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⣋⣩⣭⣥⣤⣴⣶⣶⣶⣶⣶⣶⣶⣶⣶
# ⣆⠀⠀⠀⢡⠁⠀⡀⠀⢸⠟⠻⣯⠙⠛⠷⣶⣬⡙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢉⣥⣶⡟⠻⣙⡉⠀⢰⡆⠀⠀⣡⠀⣧⠀⠀⠀⢨
# ⠻⣦⠀⠀⠈⣇⣀⣧⣴⣿⣶⣶⣿⣷⠀⢀⡇⠉⠻⢶⣌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡶⠟⠉⠀⢣⠀⣿⠷⠀⠀⠀⠀⣿⡷⢀⠇⠀⠀⢠⣿
# ⣦⡈⢧⡀⠀⠘⢮⡙⠛⠉⠀⠄⠙⢿⣀⠞⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠈⠳⣄⠉⠓⠒⠚⠋⢀⡠⠋⠀⢀⣴⣏⣿
# ⣿⣿⣿⣛⣦⣀⠀⠙⠓⠦⠤⣤⠔⠛⠁⠀⠀⠀⠀⠀⢀⣀⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣤⣤⣤⣤⣀⣀⣀⣀⢙⢓⣒⡒⠚⠋⢠⣤⢶⣟⣽⣿⣿
# ⣿⣿⣿⣿⣿⣿⣷⣦⠀⠀⣴⣿⣷⣶⣶⣶⣾⡖⢰⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿⣿⣶⣾⣿⣿⣿⣿⣿⣿
# ⣿⣿⣿⣿⣿⣿⣿⣿⠀⢀⣿⣿⣿⣿⣿⣿⣿⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
# ⣿⣿⣿⣿⣿⣿⣿⡏⠀⢸⣿⣿⣿⣿⣿⣿⣿⠁⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
# ⣿⣿⣿⣿⣿⣿⣿⣷⠀⢸⣿⣿⣿⣿⣿⣿⣿⠀⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
# 🔒 Licensed under the GNU GPLv3
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html
# https://t.me/amorescam
# meta developer: @amoremods
# meta banner: https://raw.githubusercontent.com/AmoreForever/assets/master/Universaltime.jpg
# @Den4ikSuperOstryyPer4ik: I Love AmoreMods :)
from .. import loader, utils
import datetime
from ..inline.types import InlineCall
import logging
logger = logging.getLogger(__name__)
def check_time():
offsets = [3, 5, 4, 2, 1, -7, 6, 9, 5.30, 9, 8, -8, -4]
hrs = []
for x in offsets:
offset = datetime.timedelta(hours=x)
not_tz = datetime.timezone(offset)
time = datetime.datetime.now(not_tz)
format_ = time.strftime("%d.%m.%y | %H:%M")
hrs.append(format_)
return f"🌐 Universal time\n\n🇷🇺 Russia ➪ {hrs[0]}\n🇺🇿 Uzbekistan ➪ {hrs[1]}\n🇺🇦 Ukraine ➪ {hrs[3]}\n🇦🇿 Azerbaijan ➪ {hrs[2]}\n🇩🇪 German ➪ {hrs[3]}\n🇬🇧 UK ➪ {hrs[4]}\n🇵🇱 Poland ➪ {hrs[3]}\n🇺🇸 USA ➪ {hrs[5]}\n🇰🇬 Kyrgyzstan ➪ {hrs[6]}\n🇰🇿 Kazakhstan ➪ {hrs[6]}\n🇮🇶 Iraq ➪ {hrs[0]}\n🇯🇵 Japan ➪ {hrs[7]}\n🇰🇷 South KR ➪ {hrs[7]}\n🇮🇳 India ➪ {hrs[8]}\n🇫🇷 France ➪ {hrs[3]}\n🇨🇳 China ➪ {hrs[9]}\n🇹🇷 Turkey ➪ {hrs[0]}\n🇨🇱 Mongolia ➪ {hrs[10]}\n🇨🇦 Canada ➪ {hrs[11]}\n🇮🇹 Italia ➪ {hrs[2]}\n🇪🇬 Egypt ➪ {hrs[3]}\n🇦🇲 Armenia ➪ {hrs[12]}\n\n🍙 #whyamore"
@loader.tds
class UniversalTimeMod(loader.Module):
"""See the time of other countries"""
strings = {"name": "UnivTime"}
@loader.command(ru_docs="Смотреть мировое время")
async def atimecmd(self, message):
"""See time"""
kk = check_time()
await utils.answer(message, kk)
@loader.command(ru_docs="Смотреть мировое время в инлайн режиме")
async def atimeicmd(self, message):
"""See time on inline mode"""
kk = check_time()
await self.inline.form(
text=kk,
message=message,
gif="https://te.legra.ph/file/2ab9b131ceceb9b020583.mp4",
reply_markup=[
[
{
"text": "🍃 Refresh",
"callback": self.refresh,
}
],
[
{
"text": "🔻 Close",
"action": "close",
}
]
]
)
async def refresh(self, call: InlineCall): # thanks @Den4ikSuperOstryyPer4ik
kk = check_time()
await call.edit(
text=kk,
reply_markup=[
[
{
"text": "🍃 Refresh",
"callback": self.refresh,
}
],
[
{
"text": "🔻 Close",
"action": "close",
}
]
]
)
await call.answer("Refreshed ✨")