add yookassa
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
from telebot.types import LabeledPrice, Message, PreCheckoutQuery
|
||||||
|
from ..config import YOOPAY, bot
|
||||||
|
|
||||||
|
prices = [LabeledPrice('Сумма', 100_00)]
|
||||||
|
|
||||||
|
|
||||||
|
@bot.message_handler(commands=['donate'])
|
||||||
|
def request_invoice(message: Message):
|
||||||
|
bot.send_invoice(message.chat.id, 'Поддержать проект', 'Stan', 'donate_stan', provider_token=YOOPAY,
|
||||||
|
currency='RUB', prices=prices,
|
||||||
|
provider_data='{"capture": true}',
|
||||||
|
max_tip_amount=500_000_00,
|
||||||
|
suggested_tip_amounts=[150_00, 300_00, 500_00, 1_000_00], capture=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@bot.pre_checkout_query_handler(func=lambda a: True)
|
||||||
|
def process_pre_checkout(q: PreCheckoutQuery):
|
||||||
|
bot.answer_pre_checkout_query(q.id, True, 'Извините, пожертвования больше не принимаем!')
|
||||||
+3
-1
@@ -6,12 +6,14 @@ from telebot import TeleBot, logger, types
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y.%m.%d %H:%M:%S')
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y.%m.%d %H:%M:%S')
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
logging.critical('STAN STARTED!')
|
logging.critical('STAN STARTED!')
|
||||||
|
|
||||||
logger.setLevel(logging.INFO)
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
TOKEN = os.environ.get('LUTZPYBOT', 'Token not in ENVIRON')
|
TOKEN = os.environ.get('LUTZPYBOT', 'Token not in ENVIRON')
|
||||||
|
YOOPAY = os.environ.get('YOOKASSA')
|
||||||
bot = TeleBot(TOKEN, 'HTML', disable_web_page_preview=True, allow_sending_without_reply=True,
|
bot = TeleBot(TOKEN, 'HTML', disable_web_page_preview=True, allow_sending_without_reply=True,
|
||||||
colorful_logs=True)
|
colorful_logs=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user