feat(telegram_bot): added campaign creation and updating, added help command

This commit is contained in:
ITQ
2025-02-22 07:26:04 +03:00
parent ec47e7754e
commit c0f35512a1
10 changed files with 349 additions and 55 deletions
@@ -0,0 +1,21 @@
from aiogram import Router
from aiogram.filters import Command
from aiogram.fsm.context import FSMContext
from aiogram.types import Message
from aiogram_dialog import DialogManager
help_router = Router()
@help_router.message(Command("help"))
async def help_command(
message: Message, dialog_manager: DialogManager, state: FSMContext
) -> None:
response = (
"Commands:\n\n"
"/start - Start the bot and authenticate as advertiser\n"
"/campaigns - Manage your campaigns\n"
"/statistics - See your overall statistics\n"
"/logout - Logout of current advertiser account"
)
await message.answer(response)
@@ -19,7 +19,8 @@ async def start_command(
await message.answer(
"Already authenticated as"
f" <code>{state_data['advertiser']['name']}</code> "
f"(<code>{state_data['advertiser']['advertiser_id']}</code>)"
f"(<code>{state_data['advertiser']['advertiser_id']}</code>)."
"Get all commands with /help."
)
return
@@ -26,8 +26,8 @@ async def stats_command(
f"\t• Impressions: {stats.impressions_count}\n"
f"\t• Clicks: {stats.clicks_count}\n"
f"\t• Conversion: {stats.conversion:.2f}%\n"
f"\t• Spent on impressions: ${stats.spent_impressions:.2f}\n"
f"\t• Spent on clicks: ${stats.spent_clicks:.2f}\n"
f"\t• Spent total: ${stats.spent_total:.2f}"
f"\t• Spent on impressions: {stats.spent_impressions:.2f}\n"
f"\t• Spent on clicks: {stats.spent_clicks:.2f}\n"
f"\t• Spent total: {stats.spent_total:.2f}"
)
await message.answer(response)