change 題外 to outside
This commit is contained in:
34
bot.py
34
bot.py
@ -19,7 +19,7 @@ import external
|
|||||||
bot = telepot.Bot(TOKEN)
|
bot = telepot.Bot(TOKEN)
|
||||||
|
|
||||||
class Kuser:
|
class Kuser:
|
||||||
def __init__(self, userid, username='', password='', status='第一次用', question='題外'):
|
def __init__(self, userid, username='', password='', status='第一次用', question='outside'):
|
||||||
self.userid = userid
|
self.userid = userid
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
@ -34,13 +34,13 @@ class Kuser:
|
|||||||
|
|
||||||
# 輸入學號
|
# 輸入學號
|
||||||
def press_username(self):
|
def press_username(self):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '輸入學號'
|
self.status = '輸入學號'
|
||||||
bot.sendMessage(self.userid, "請輸入您的學號:", reply_markup=ReplyKeyboardRemove())
|
bot.sendMessage(self.userid, "請輸入您的學號:", reply_markup=ReplyKeyboardRemove())
|
||||||
|
|
||||||
# 輸入密碼
|
# 輸入密碼
|
||||||
def press_password(self, text):
|
def press_password(self, text):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '輸入密碼'
|
self.status = '輸入密碼'
|
||||||
self.username = text
|
self.username = text
|
||||||
bot.sendMessage(self.userid,
|
bot.sendMessage(self.userid,
|
||||||
@ -51,7 +51,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 輸入舊密碼
|
# 輸入舊密碼
|
||||||
def press_oldpassword(self):
|
def press_oldpassword(self):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '舊的密碼'
|
self.status = '舊的密碼'
|
||||||
bot.sendMessage(self.userid,
|
bot.sendMessage(self.userid,
|
||||||
"請輸入要原本的舊密碼:",
|
"請輸入要原本的舊密碼:",
|
||||||
@ -62,7 +62,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 輸入新密碼
|
# 輸入新密碼
|
||||||
def press_newpassword(self, text):
|
def press_newpassword(self, text):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
# 判斷舊密碼是否輸入正確
|
# 判斷舊密碼是否輸入正確
|
||||||
if text == self.password:
|
if text == self.password:
|
||||||
# 正確舊密碼
|
# 正確舊密碼
|
||||||
@ -85,7 +85,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 開始修改密碼
|
# 開始修改密碼
|
||||||
def change_password(self, text):
|
def change_password(self, text):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
self.password = text
|
self.password = text
|
||||||
bot.sendMessage(self.userid,
|
bot.sendMessage(self.userid,
|
||||||
@ -97,7 +97,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 執行登入
|
# 執行登入
|
||||||
def login(self, text):
|
def login(self, text):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
self.password = text
|
self.password = text
|
||||||
bot.sendMessage(self.userid, "登入中...", reply_markup=ReplyKeyboardRemove())
|
bot.sendMessage(self.userid, "登入中...", reply_markup=ReplyKeyboardRemove())
|
||||||
@ -106,7 +106,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 登入失敗
|
# 登入失敗
|
||||||
def login_failed(self, chat_id, message_id):
|
def login_failed(self, chat_id, message_id):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
# 判斷使用者從哪操作
|
# 判斷使用者從哪操作
|
||||||
if chat_id != self.userid:
|
if chat_id != self.userid:
|
||||||
@ -119,7 +119,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 網站連接失敗
|
# 網站連接失敗
|
||||||
def connect_failed(self, chat_id, message_id):
|
def connect_failed(self, chat_id, message_id):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
# 群組操作
|
# 群組操作
|
||||||
if chat_id != self.userid:
|
if chat_id != self.userid:
|
||||||
@ -159,14 +159,14 @@ class Kuser:
|
|||||||
|
|
||||||
# 登出
|
# 登出
|
||||||
def logout(self):
|
def logout(self):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
bot.sendMessage(self.userid, "您現在已經是登出的狀態。", reply_markup=ReplyKeyboardRemove())
|
bot.sendMessage(self.userid, "您現在已經是登出的狀態。", reply_markup=ReplyKeyboardRemove())
|
||||||
self.press_username()
|
self.press_username()
|
||||||
|
|
||||||
# 秀出主畫面
|
# 秀出主畫面
|
||||||
def show_homepage(self, chat_id):
|
def show_homepage(self, chat_id):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
# 題目列表字典
|
# 題目列表字典
|
||||||
q_dict = self.api.list_questions()
|
q_dict = self.api.list_questions()
|
||||||
@ -213,7 +213,7 @@ class Kuser:
|
|||||||
|
|
||||||
# 列出題目列表
|
# 列出題目列表
|
||||||
def list_questions(self, chat_id):
|
def list_questions(self, chat_id):
|
||||||
self.question = '題外'
|
self.question = 'outside'
|
||||||
self.status = '正常使用'
|
self.status = '正常使用'
|
||||||
# 題目列表字典
|
# 題目列表字典
|
||||||
q_dict = self.api.list_questions()
|
q_dict = self.api.list_questions()
|
||||||
@ -591,27 +591,27 @@ def on_chat(msg):
|
|||||||
user.logout()
|
user.logout()
|
||||||
|
|
||||||
# 刪除作業
|
# 刪除作業
|
||||||
elif (command[0] == '/delete' or command[0] == '刪除作業⚔️') and user.question != '題外':
|
elif (command[0] == '/delete' or command[0] == '刪除作業⚔️') and user.question != 'outside':
|
||||||
if user.check_online(chat_id, msg['message_id']):
|
if user.check_online(chat_id, msg['message_id']):
|
||||||
user.delete_answer()
|
user.delete_answer()
|
||||||
|
|
||||||
# 選擇要上傳的作業
|
# 選擇要上傳的作業
|
||||||
elif (command[0] == '/upload' or command[0] == '交作業📮') and user.question != '題外':
|
elif (command[0] == '/upload' or command[0] == '交作業📮') and user.question != 'outside':
|
||||||
if user.check_online(chat_id, msg['message_id']):
|
if user.check_online(chat_id, msg['message_id']):
|
||||||
user.upload_answer()
|
user.upload_answer()
|
||||||
|
|
||||||
# 看作業執行結果
|
# 看作業執行結果
|
||||||
elif (command[0] == '/result' or command[0] == '看結果☑️') and user.question != '題外':
|
elif (command[0] == '/result' or command[0] == '看結果☑️') and user.question != 'outside':
|
||||||
if user.check_online(chat_id, msg['message_id']):
|
if user.check_online(chat_id, msg['message_id']):
|
||||||
user.list_results()
|
user.list_results()
|
||||||
|
|
||||||
# 看本題已通過者
|
# 看本題已通過者
|
||||||
elif (command[0] == '/passer' or command[0] == '通過者🌐') and user.question != '題外':
|
elif (command[0] == '/passer' or command[0] == '通過者🌐') and user.question != 'outside':
|
||||||
if user.check_online(chat_id, msg['message_id']):
|
if user.check_online(chat_id, msg['message_id']):
|
||||||
user.list_passers()
|
user.list_passers()
|
||||||
|
|
||||||
# 回到題目內容
|
# 回到題目內容
|
||||||
elif command[0] == '回題目📜' and user.question != '題外':
|
elif command[0] == '回題目📜' and user.question != 'outside':
|
||||||
if user.check_online(chat_id, msg['message_id']):
|
if user.check_online(chat_id, msg['message_id']):
|
||||||
user.show_question(user.question, chat_id)
|
user.show_question(user.question, chat_id)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user