-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexam_handler.py
86 lines (73 loc) · 4.24 KB
/
exam_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import logging
from telegram.ext import (
Updater,
CommandHandler,
CallbackContext,
MessageHandler,
CallbackQueryHandler,
InlineQueryHandler, ConversationHandler,
)
from telegram import (
ReplyKeyboardMarkup,
InlineKeyboardMarkup,
InlineKeyboardButton,
InlineQueryResultArticle,
InputTextMessageContent,
Update,
ParseMode,
error,
)
from telegram.ext.filters import Filters
from telegram.chataction import ChatAction
from bs4 import BeautifulSoup
from uuid import uuid4
import requests
from telegram.utils.helpers import escape_markdown
from bot import messages
def exam_ap_file_handler(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
try:
context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_DOCUMENT)
context.bot.send_document(chat_id=update.effective_chat.id, document='BQACAgQAAxkDAAIOA2EvpGPuvMDrLtioE7S4d'
'plwkDZtAAKGCwACvnOBURIJI-dSD7TGIAQ',
filename='AP exams.zip',
caption='سوالات امتحانی برنامه سازی پیشرفته دکتر پایدار', timeout=60)
except error.NetworkError as e:
update.message.reply_text(text=messages['msg_network_error'])
def exam_discrete_bafghi_file_handler(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
try:
context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_DOCUMENT, timeout=300)
context.bot.send_document(chat_id=update.effective_chat.id, document='BQACAgQAAxkDAAIOGWEvqEl-8BKckRp3oqlRQZE'
'fettOAAKWCwACvnOBUQP4XT_T7-rsIAQ',
filename='Discrete exams & exe (Bafghi)',
caption='تمرینات و امتحانات ریاضیات گسسته استاد بافقی', timeout=200)
except error.NetworkError as e:
update.message.reply_text(text=messages['msg_network_error'])
def exam_discrete_structure_file_handler(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_DOCUMENT)
try:
context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_DOCUMENT, timeout=300)
context.bot.send_document(chat_id=update.effective_chat.id, document='BQACAgQAAxkDAAIOF2Evp3rOZ4ILOBWni6xh3Y97y'
'ud6AAKUCwACvnOBUdfT2nMzrPC9IAQ',
filename='Discrete Structure', caption='تمرینات ساختمان گسسته', timeout=300)
except error.NetworkError as e:
update.message.reply_text(text=messages['msg_network_error'])
def exam_fp_file_handler(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
context.bot.send_chat_action(chat_id, ChatAction.TYPING)
context.bot.send_message(chat_id=update.effective_chat.id, text='این بخش در حال بروزرسانی است، به زودی فایل های'
' مربوطه قرار خواهند گرفت')
def exam_ds_file_handler(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
context.bot.send_chat_action(chat_id, ChatAction.UPLOAD_DOCUMENT)
context.bot.send_document(chat_id=update.effective_chat.id, document='BQACAgQAAxkBAAIUVWE1xLqU2lUhw1O_toh68mkaFXe'
'2AAKRCwAC5miwUTynOJTv3cEYIAQ',
filename='DS Ghiasi',
caption='فایل درس ساختمان داده غیاثی 99', timeout=60)
def exam_differential_equation(update: Update, context: CallbackContext) -> None:
chat_id = update.message.chat_id
context.bot.send_chat_action(chat_id, ChatAction.TYPING)
context.bot.send_message(chat_id=update.effective_chat.id, text='کانال حل تمرین نمونه سوالات(محمدیان):\n'
'https://t.me/tamrin_moadelat_fum')