27 lines
995 B
Python
27 lines
995 B
Python
|
from bot.config import FEEDBACK_CHAT_ID
|
||
|
from bot.announce import edit_announce
|
||
|
from bot.api import telegram_api
|
||
|
import logging
|
||
|
|
||
|
logger = logging.getLogger(__name__)
|
||
|
logging.basicConfig(level=logging.INFO)
|
||
|
|
||
|
start_message = {
|
||
|
'en': "Welcome home! You can type any message here to be passed to chat",
|
||
|
'ru': "Доброе утро! Можешь напечатать здесь любое сообщение для передачи в чат"
|
||
|
}
|
||
|
|
||
|
async def handle_private(msg, state):
|
||
|
text = msg.get("text")
|
||
|
sender = msg.get("from", {})
|
||
|
lang = sender.get("language_code", "ru")
|
||
|
if lang != "ru" and lang != "en":
|
||
|
lang = "en"
|
||
|
if text.startswith("/"):
|
||
|
if text == '/start':
|
||
|
await telegram_api("sendMessage", chat_id=sender.get("id"), text=start_message[lang])
|
||
|
else:
|
||
|
await telegram_api("forwardMessage", from_chat_id=sender.get("id"), message_id=msg.get("id"), chat_id=FEEDBACK_CHAT_ID)
|
||
|
else:
|
||
|
await edit_announce(msg)
|