mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 01:15:31 +00:00
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""
|
|
Babel is required.
|
|
"""
|
|
|
|
import asyncio
|
|
import logging
|
|
|
|
from aiogram import Bot, types
|
|
from aiogram.dispatcher import Dispatcher
|
|
from aiogram.types import ParseMode
|
|
from aiogram.utils.executor import start_pooling
|
|
from aiogram.utils.markdown import *
|
|
|
|
API_TOKEN = 'BOT TOKEN HERE'
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
loop = asyncio.get_event_loop()
|
|
bot = Bot(token=API_TOKEN, loop=loop)
|
|
dp = Dispatcher(bot)
|
|
|
|
|
|
@dp.message_handler()
|
|
async def check_language(message: types.Message):
|
|
locale = message.from_user.locale
|
|
|
|
await message.reply(text(
|
|
bold('Info about your language:'),
|
|
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)),
|
|
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__':
|
|
start_pooling(dp, loop=loop, skip_updates=True)
|