S-bot-tg/support.py

48 lines
1.9 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from config import db, dp, oper_group_id, supp_group_id, use_chats, bot
from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.types import ParseMode, Message
from essentials import *
from personnel import *
call_oper = False
call_supp = False
@dp.callback_query_handler(text='askpers')
async def permsg(call: types.CallbackQuery):
await call.message.answer('☎ Связь с персоналом.')
mkp = types.InlineKeyboardMarkup()
btn1 = types.InlineKeyboardButton('Написать оператору', call_oper = True)
btn2 = types.InlineKeyboardButton('Написать в поддержку', call_supp = True)
btn2 = types.InlineKeyboardButton('В меню', callback_data='menu')
mkp.add(btn1, btn2, btn3).add(btn3)
return mkp
if call_oper == True:
@dp.message_handler()
async def opermsg(message):
await bot.send_message(f'Вызван оператор, ожидайте.')
call_oper = False
if use_chats == True:
await bot.send_message(oper_group_id, f'Запрос оператора для: {client}')
await bot.forward_message(oper_group_id, message.chat.id, message.message_id)
else:
await bot.send_message(operators, f'Запрос оператора для: {client}')
await bot.forward_message(operators, message.chat.id, message.message_id)
await state.finish()
if call_supp == True:
@dp.message_handler()
async def suppmsg(message):
await bot.send_message(f'Ваш тикет передан, ожидайте.')
call_supp = False
if use_chats == True:
await bot.send_message(supp_group_id, f'Запрос оператора для: {client}')
await bot.forward_message(supp_group_id, message.chat.id, message.message_id)
else:
await bot.send_message(supporters, f'Запрос оператора для: {client}')
await bot.forward_message(supporters, message.chat.id, message.message_id)
await state.finish()