2017-06-02 05:09:09 +03:00
|
|
|
"""
|
|
|
|
|
Babel is required.
|
|
|
|
|
"""
|
|
|
|
|
|
2017-05-27 03:58:34 +03:00
|
|
|
import asyncio
|
|
|
|
|
import logging
|
|
|
|
|
|
2017-06-03 10:53:13 +03:00
|
|
|
from aiogram import Bot, types
|
2017-05-27 03:58:34 +03:00
|
|
|
from aiogram.dispatcher import Dispatcher
|
2017-06-02 05:09:09 +03:00
|
|
|
from aiogram.types import ParseMode
|
2017-11-19 01:05:50 +02:00
|
|
|
from aiogram.utils.executor import start_pooling
|
2017-05-27 03:58:34 +03:00
|
|
|
from aiogram.utils.markdown import *
|
|
|
|
|
|
|
|
|
|
API_TOKEN = 'BOT TOKEN HERE'
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
2017-06-02 05:09:09 +03:00
|
|
|
bot = Bot(token=API_TOKEN, loop=loop)
|
2017-05-27 03:58:34 +03:00
|
|
|
dp = Dispatcher(bot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dp.message_handler()
|
2017-06-03 10:53:13 +03:00
|
|
|
async def check_language(message: types.Message):
|
2017-06-01 22:53:29 +03:00
|
|
|
locale = message.from_user.locale
|
2017-05-27 03:58:34 +03:00
|
|
|
|
|
|
|
|
await message.reply(text(
|
|
|
|
|
bold('Info about your language:'),
|
2017-06-01 22:53:29 +03:00
|
|
|
text(' 🔸', bold('Code:'), italic(locale.locale)),
|
|
|
|
|
text(' 🔸', bold('Territory:'), italic(locale.territory or 'Unknown')),
|
|
|
|
|
text(' 🔸', bold('Language name:'), italic(locale.language_name)),
|
|
|
|
|
text(' 🔸', bold('English language name:'), italic(locale.english_name)),
|
2017-05-27 03:58:34 +03:00
|
|
|
sep='\n'), parse_mode=ParseMode.MARKDOWN)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
|
count = await dp.skip_updates()
|
|
|
|
|
print(f"Skipped {count} updates.")
|
|
|
|
|
await dp.start_pooling()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-11-19 01:05:50 +02:00
|
|
|
start_pooling(dp, loop=loop, skip_updates=True)
|