Merge pull request #16 from surik00/dev-1.x

Super minor fixes in typography + payments example improvement
This commit is contained in:
Alex Root Junior 2018-02-17 20:39:20 +02:00 committed by GitHub
commit 7ed1f998cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 119 additions and 114 deletions

View file

@ -492,7 +492,7 @@ class Bot(BaseBot):
Source: https://core.telegram.org/bots/api#sendmediagroup Source: https://core.telegram.org/bots/api#sendmediagroup
:param chat_id: Unique identifier for the target chat or username of the target channel :param chat_id: Unique identifier for the target chat or username of the target channel
:type chat_id: :obj:`typing.Union[base.Integer, base.String]` :type chat_id: :obj:`typing.Union[base.Integer, base.String]`
:param media: A JSON-serialized array describing photos and videos to be sent :param media: A JSON-serialized array describing photos and videos to be sent
:type media: :obj:`typing.Union[types.MediaGroup, typing.List]` :type media: :obj:`typing.Union[types.MediaGroup, typing.List]`

View file

@ -663,6 +663,9 @@ class ContentType(helper.Helper):
:key: LEFT_CHAT_MEMBER :key: LEFT_CHAT_MEMBER
:key: INVOICE :key: INVOICE
:key: SUCCESSFUL_PAYMENT :key: SUCCESSFUL_PAYMENT
:key: CONNECTED_WEBSITE
:key: UNKNOWN
:key: ANY
""" """
mode = helper.HelperMode.snake_case mode = helper.HelperMode.snake_case

View file

@ -2,8 +2,10 @@ import asyncio
from aiogram import Bot from aiogram import Bot
from aiogram import types from aiogram import types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor from aiogram.utils import executor
from aiogram.dispatcher import Dispatcher
from aiogram.types.message import ContentType
BOT_TOKEN = 'BOT TOKEN HERE' BOT_TOKEN = 'BOT TOKEN HERE'
PAYMENTS_PROVIDER_TOKEN = '123456789:TEST:1234567890abcdef1234567890abcdef' PAYMENTS_PROVIDER_TOKEN = '123456789:TEST:1234567890abcdef1234567890abcdef'
@ -84,7 +86,7 @@ async def checkout(pre_checkout_query: types.PreCheckoutQuery):
" try to pay again in a few minutes, we need a small rest.") " try to pay again in a few minutes, we need a small rest.")
@dp.message_handler(content_types=['successful_payment']) @dp.message_handler(content_types=ContentType.SUCCESSFUL_PAYMENT)
async def got_payment(message: types.Message): async def got_payment(message: types.Message):
await bot.send_message(message.chat.id, await bot.send_message(message.chat.id,
'Hoooooray! Thanks for payment! We will proceed your order for `{} {}`' 'Hoooooray! Thanks for payment! We will proceed your order for `{} {}`'