format Black

This commit is contained in:
Rykov7
2023-02-22 18:53:12 +03:00
parent 23a93b5dbd
commit d0cf0762c8
13 changed files with 356 additions and 205 deletions
+18 -9
View File
@@ -1,19 +1,28 @@
from telebot.types import LabeledPrice, Message, PreCheckoutQuery
from ..config import YOOPAY, bot
prices = [LabeledPrice('Сумма', 100_00)]
prices = [LabeledPrice("Сумма", 100_00)]
@bot.message_handler(commands=['donate'])
@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.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, 'Извините, пожертвования больше не принимаем!')
bot.answer_pre_checkout_query(
q.id, True, "Извините, пожертвования больше не принимаем!"
)
+5 -3
View File
@@ -2,9 +2,11 @@ from urllib.request import urlopen
def my_ip():
ip_service = 'https://icanhazip.com'
ip = urlopen(ip_service, )
return ip.read().decode('utf-8')
ip_service = "https://icanhazip.com"
ip = urlopen(
ip_service,
)
return ip.read().decode("utf-8")
def me(message):
+26 -19
View File
@@ -10,20 +10,20 @@ from ..filters import is_admin
from .get import me, my_ip
@bot.message_handler(commands=['me'])
@bot.message_handler(commands=["me"])
def command_me(message):
""" Send info about user and chat id [Service]. """
"""Send info about user and chat id [Service]."""
bot.send_message(message.chat.id, me(message))
@bot.message_handler(func=is_admin, commands=['ip'])
@bot.message_handler(func=is_admin, commands=["ip"])
def get_ip(message):
bot.send_message(message.chat.id, my_ip())
@bot.message_handler(commands=['remind'])
@bot.message_handler(commands=["remind"])
def remind_manually(message):
""" Remind holidays manually. """
"""Remind holidays manually."""
args = message.text.split()
if len(args) > 1:
try:
@@ -33,38 +33,45 @@ def remind_manually(message):
else:
reminder.remind(message.chat.id, today)
else:
bot.send_message(message.chat.id, f"<b>Формат даты: MM-DD-YYYY</b>\n\n"
f"Примеры:\n"
f"/remind 09-12-2024\n"
f"/remind 09-13-2022")
bot.send_message(
message.chat.id,
f"<b>Формат даты: MM-DD-YYYY</b>\n\n"
f"Примеры:\n"
f"/remind 09-12-2024\n"
f"/remind 09-13-2022",
)
@bot.message_handler(func=is_admin, commands=['jobs'])
@bot.message_handler(func=is_admin, commands=["jobs"])
def list_jobs(message):
""" List all the jobs in schedule. """
"""List all the jobs in schedule."""
bot.send_message(ADMIN_ID, reminder.print_get_jobs())
@bot.message_handler(func=is_admin, commands=['stats'])
@bot.message_handler(func=is_admin, commands=["stats"])
def send_stats(message: types.Message):
if len(message.text.split()) == 1:
rep = report.create_report_text(message.chat.id)
if rep:
bot.send_message(message.chat.id, rep)
else:
bot.send_message(message.chat.id, report.create_report_text(message.text.split()[-1]))
bot.send_message(
message.chat.id, report.create_report_text(message.text.split()[-1])
)
@bot.message_handler(func=is_admin, commands=['reset_stats'], chat_types=['supergroup', 'group'])
@bot.message_handler(
func=is_admin, commands=["reset_stats"], chat_types=["supergroup", "group"]
)
def send_stats(message: types.Message):
logging.warning('reset_stats')
logging.warning("reset_stats")
report.reset_report_stats(message.chat.id)
bot.send_message(message.chat.id, report.reset_report_stats(message.chat.id))
@bot.message_handler(func=is_admin, commands=['reload'])
@bot.message_handler(func=is_admin, commands=["reload"])
def send_stats(message):
logging.warning('Reloading...')
logging.warning("Reloading...")
reloader.reload_modules()
logging.warning('Reloaded!!!')
bot.send_message(message.chat.id, 'Reloaded successfully')
logging.warning("Reloaded!!!")
bot.send_message(message.chat.id, "Reloaded successfully")