add language display

This commit is contained in:
2018-04-04 17:42:22 +08:00
parent fa0e6bffa7
commit 48ae4f97e3
2 changed files with 7 additions and 6 deletions

View File

@ -127,7 +127,7 @@ class Kuser:
q_str = ''
for key in q_dict.keys():
if q_dict[key][1] == '期限未到':
q_str += "📗<b>" + key + "</b> (DL: " + q_dict[key][0] + ")\n [[" + q_dict[key][2] + "]]"
q_str += "📗<b>" + key + "</b> (DL: " + q_dict[key][0] + ")\n [[" + q_dict[key][3] + "]] [[" + q_dict[key][2] + "]]"
q_str += "⚠️" if q_dict[key][2] == '未繳' else ""
q_str += " /question_" + key + "\n\n"
bot.sendMessage(chat_id, "💁 <b>" + self._username + "</b> " + NAME + "\n"
@ -148,7 +148,7 @@ class Kuser:
q_str = ''
for key in q_dict.keys():
q_str += "📗" if q_dict[key][1] == '期限未到' else "📕"
q_str += "<b>" + key + "</b> (DL: " + q_dict[key][0] + ")\n [[" + q_dict[key][2] + "]]"
q_str += "<b>" + key + "</b> (DL: " + q_dict[key][0] + ")\n [[" + q_dict[key][3] + "]] [[" + q_dict[key][2] + "]]"
q_str += "⚠️" if q_dict[key][2] == '未繳' else ""
q_str += " /question_" + key + "\n\n"
reply = bot.sendMessage(chat_id, "💁 <b>" + self._username + "</b> " + NAME + "\n"
@ -176,7 +176,7 @@ class Kuser:
q_str = "💁 *" + self._username + "* [" + NAME + "]\n"
q_str += "\n"
q_str += "📗" if q[1] == '期限未到' else "📕"
q_str += "*" + number + "* (DL: " + q[0] + ")\n [[[" + q[2] + "]]]"
q_str += "*" + number + "* (DL: " + q[0] + ")\n [[[" + q[3] + "]]] [[[" + q[2] + "]]]"
q_str += "⚠️" if q[2] == '未繳' else ""
reply = bot.sendMessage(chat_id, q_str + "\n\n" + content,
parse_mode='Markdown',
@ -215,7 +215,7 @@ class Kuser:
q_str = "💁 <b>" + self._username + "</b> " + NAME + "\n"
q_str += "\n"
q_str += "📗" if q[1] == '期限未到' else "📕"
q_str += "<b>" + self._question + "</b> (DL: " + q[0] + ")\n [[" + q[2] + "]]"
q_str += "<b>" + self._question + "</b> (DL: " + q[0] + ")\n [[" + q[3] + "]] [[" + q[2] + "]]"
q_str += "⚠️" if q[2] == '未繳' else ""
bot.sendMessage(self._userid, q_str + "\n\n現在請把你的程式碼讓我看看(請別超過 20 MB\n"
"可以使用「文字訊息」或是「傳送檔案」的方式\n"
@ -269,7 +269,7 @@ class Kuser:
q_str = "💁 <b>" + self._username + "</b> " + NAME + "\n"
q_str += "\n"
q_str += "📗" if q[1] == '期限未到' else "📕"
q_str += "<b>" + self._question + "</b> (DL: " + q[0] + ")\n [[" + q[2] + "]]"
q_str += "<b>" + self._question + "</b> (DL: " + q[0] + ")\n [[" + q[3] + "]] [[" + q[2] + "]]"
q_str += "⚠️" if q[2] == '未繳' else ""
q_str += "<code>\n"
for passer in self._api.list_passers(self._question):

View File

@ -39,7 +39,8 @@ class KCOJ:
deadline = tag.find_all('td')[3].get_text().strip()
submit = "期限已到" if tag.find_all('td')[4].get_text().strip() == "期限已過" else "期限未到"
status = tag.find_all('td')[6].get_text().strip()
questions[number] = (deadline, submit, status)
language = tag.find_all('td')[5].get_text().strip()
questions[number] = (deadline, submit, status, language)
return questions
except requests.exceptions.Timeout:
return {'Timeout':('Timeout', 'Timeout', 'Timeout')}