Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SimpleQIWI
- from SimpleQIWI import *
- import telebot
- import json
- import time
- bot = telebot.TeleBot('*****************************************')
- N53 = '7*********'
- api53 = '***********'
- N15 = '************'
- api15 = '***************'
- N00 = '**************'
- api00 = '*********************'
- mainKeyboard = telebot.types.ReplyKeyboardMarkup(True, True)
- mainKeyboard.row('Балансы киви кошельков')
- mainKeyboard.row('Перевести все деньги на один кошелек')
- qiwiBalances = telebot.types.ReplyKeyboardMarkup(True, True)
- qiwiBalances.row('узнать баланс киви ' + N15)
- qiwiBalances.row('узнать баланс киви ' + N53)
- qiwiBalances.row('узнать баланс киви ' + N00)
- qiwiBalances.row('Узнать общий баланс всех кошельков')
- qiwisending = telebot.types.ReplyKeyboardMarkup(True, True)
- qiwisending.row('Отправить деньги на ' + N53)
- qiwisending.row('Отправить деньги на ' + N00)
- qiwisending.row('Отправить деньги на ' + N15)
- def QiwiBalance(number, apitoken):
- api = QApi(token=apitoken, phone=number)
- RuBalance = api.balance[0]
- return RuBalance
- def All_balances(number, apitoken, number2, apitoken2, number3, apitoken3):
- api = QApi(token=apitoken, phone=number)
- RuBalance = api.balance[0]
- api = QApi(token=apitoken2, phone=number2)
- RuBalance2 = api.balance[0]
- api = QApi(token=apitoken3, phone=number3)
- RuBalance3 = api.balance[0]
- AllEND_ball = RuBalance + RuBalance2 + RuBalance3
- return AllEND_ball
- def sendingEnd(number, apitoken, mainQiwi):
- fail = 'fail'
- api = QApi(token=apitoken, phone=number)
- BalanceQiwi = api.balance[0]
- if BalanceQiwi > 1:
- sendingAmout = int(api.balance[0]) * 0.98
- print(sendingAmout)
- api.pay(account=mainQiwi, amount=1, comment='Перевод всех бабок на 1 кивас')
- else:
- return fail
- def sendingEnd2(number2, apitoken2, mainQiwi):
- fail2 = 'fail'
- api = QApi(token=apitoken2, phone=number2)
- BalanceQiwi = api.balance[0]
- if BalanceQiwi > 1:
- sendingAmout = int(api.balance[0]) * 0.98
- print(sendingAmout)
- api.pay(account=mainQiwi, amount=1, comment='Перевод всех бабок на 1 кивас')
- else:
- return fail2
- @bot.message_handler(commands=['start'])
- def start_message(message):
- user_id_get = message.from_user.id
- if user_id_get == 661081972:
- bot.send_message(message.chat.id,
- 'Приветствую, мой господин!',
- reply_markup=mainKeyboard)
- @bot.message_handler(content_types=['text'])
- def send_message(message):
- user_id_get = message.from_user.id
- if message.text == 'Балансы киви кошельков' and user_id_get == 661081972:
- bot.send_message(message.chat.id, 'Выбирай то, что тебе нужно',
- reply_markup=qiwiBalances)
- if message.text == 'узнать баланс киви ' + N15 and user_id_get == 661081972:
- End_balance = QiwiBalance(N15, api15)
- bot.send_message(message.chat.id, 'Баланс киви кошелька : ' + str(End_balance) + 'Рублей',
- reply_markup=mainKeyboard)
- if message.text == 'узнать баланс киви ' + N53 and user_id_get == 661081972:
- End_balance = QiwiBalance(N53, api53)
- bot.send_message(message.chat.id, 'Баланс киви кошелька : ' + str(End_balance) + ' Рублей',
- reply_markup=mainKeyboard)
- if message.text == 'узнать баланс киви ' + N00 and user_id_get == 661081972:
- End_balance = QiwiBalance(N00, api00)
- bot.send_message(message.chat.id, 'Баланс киви кошелька : ' + str(End_balance) + 'Рублей',
- reply_markup=mainKeyboard)
- if message.text == 'Узнать общий баланс всех кошельков' and user_id_get == 661081972:
- AlMyBalances = All_balances(N00, api00, N53, api53, N15, api15)
- bot.send_message(message.chat.id, 'Общий баланс : ' + str(AlMyBalances) + ' Рублей ',
- reply_markup=mainKeyboard)
- if message.text == 'Перевести все деньги на один кошелек':
- bot.send_message(message.chat.id, 'Выбирай нужный номер ',
- reply_markup=qiwisending)
- bot.register_next_step_handler(message, userNumber)
- def userNumber(message):
- userNum = message.text
- user_id_get = message.from_user.id
- if userNum == 'Отправить деньги на ' + N53 and user_id_get == 661081972:
- print(userNum)
- try:
- first = sendingEnd(N00, api00, N53)
- second = sendingEnd2(N15, api15, N53)
- if first == 'fail':
- bot.send_message(message.chat.id, 'С киви ' + N00 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N00 + ' Деньги были переведены!',
- reply_markup=mainKeyboard)
- if second == 'fail':
- bot.send_message(message.chat.id,
- 'С киви ' + N15 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N15 + ' деньги были переведены!',
- reply_markup=mainKeyboard)
- except (SimpleQIWI.Errors.QIWIAPIError):
- bot.send_message(message.chat.id, 'Баланс на одном из киви меньше минимального!',
- reply_markup=mainKeyboard)
- if userNum == 'Отправить деньги на ' + N00 and user_id_get == 661081972:
- print(userNum)
- try:
- first = sendingEnd(N15, api15, N00)
- second = sendingEnd2(N53, api53, N00)
- if first == 'fail':
- bot.send_message(message.chat.id, 'С киви ' + N15 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N15 + ' Деньги были переведены!',
- reply_markup=mainKeyboard)
- if second == 'fail':
- bot.send_message(message.chat.id,
- 'С киви ' + N53 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N53 + ' деньги были переведены!',
- reply_markup=mainKeyboard)
- except (SimpleQIWI.Errors.QIWIAPIError):
- bot.send_message(message.chat.id, 'Баланс на одном из киви меньше минимального!',
- reply_markup=mainKeyboard)
- if userNum == 'Отправить деньги на ' + N15 and user_id_get == 661081972:
- print(userNum)
- try:
- first = sendingEnd(N00, api00, N15)
- second = sendingEnd2(N53, api53, N15)
- if first == 'fail':
- bot.send_message(message.chat.id,
- 'С киви ' + N00 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N00 + ' Деньги были переведены!',
- reply_markup=mainKeyboard)
- if second == 'fail':
- bot.send_message(message.chat.id,
- 'С киви ' + N53 + ' не получилось перевести денег.Счет меньше 1 рубля ',
- reply_markup=mainKeyboard)
- else:
- bot.send_message(message.chat.id, 'С киви ' + N53 + ' деньги были переведены!',
- reply_markup=mainKeyboard)
- except (SimpleQIWI.Errors.QIWIAPIError):
- bot.send_message(message.chat.id, 'Баланс на одном из киви меньше минимального!',
- reply_markup=mainKeyboard)
- bot.polling(none_stop=True, interval=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement