Skip to content

Commit

Permalink
Merge pull request #5 from progeroffline/developing
Browse files Browse the repository at this point in the history
Move private channels to close functionality section
  • Loading branch information
progeroffline authored Sep 22, 2023
2 parents 0e59f9f + 703598d commit 1f544cc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/bot/handlers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

from .channels_join_requests import *
from .close_functionality import *
from .payment import *
from .start import *
12 changes: 12 additions & 0 deletions src/bot/handlers/close_functionality.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from aiogram import types
from filters import UserSubscribedFilter
from keyboards import inline as inline_keyboard
from loader import dp


@dp.message_handler(UserSubscribedFilter(), text='Show close functionality')
async def show_private_channels(message: types.Message):
await message.answer(
text='You can subscribe to closed channels.',
reply_markup=await inline_keyboard.channels(),
)
2 changes: 0 additions & 2 deletions src/bot/handlers/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
USDT_TRC20_WALLET_ADDRESS)
from database import transactions
from filters.user_not_subscribed import UserNotSubscribedFilter
from keyboards import inline as inline_keyboards
from keyboards import reply as reply_keyboards
from loader import dp
from statesgroup import GetTxidFromUser
Expand Down Expand Up @@ -42,7 +41,6 @@ async def check_transaction(message: types.Message, state: FSMContext):
await message.answer(
text='Great, wait for the end of the transaction, '
'and I will notify you when the subscription is charged.',
reply_markup=await inline_keyboards.channels(),
)
else:
await message.answer(
Expand Down
24 changes: 12 additions & 12 deletions src/bot/utils/subscription_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@


async def task(bot: 'aiogram.Bot'):
records = await transactions.get_new()
for record in records:
if await tronscan_service.check_transaction_for_correct_data(record.txid):
await transactions.set_status(True, database_id=record.id)
await users.set_days_sub_end(
count_days=NUMBER_DAYS_FROM_ONE_PAYMENT,
telegram_id=record.owner_telegram_id,
)

await bot.send_message(
chat_id=record.owner_telegram_id,
text='Congratulations, you now have access to limited functionality.'
records = await transactions.get_new()
for record in records:
if await tronscan_service.check_transaction_for_correct_data(record.txid):
await transactions.set_status(True, database_id=record.id)
await users.set_days_sub_end(
count_days=NUMBER_DAYS_FROM_ONE_PAYMENT,
telegram_id=record.owner_telegram_id,
)
await bot.send_message(
chat_id=record.owner_telegram_id,
text='Congratulations, you now have access to limited functionality.'
)

Binary file removed src/db/database.db-shm
Binary file not shown.
Binary file removed src/db/database.db-wal
Binary file not shown.

0 comments on commit 1f544cc

Please sign in to comment.