diff --git a/external.py b/external.py new file mode 100644 index 0000000..8f9c74c --- /dev/null +++ b/external.py @@ -0,0 +1,2 @@ +# External Questions +QUESTION = {} \ No newline at end of file diff --git a/interface.py b/interface.py index 72b211d..d861003 100644 --- a/interface.py +++ b/interface.py @@ -7,7 +7,7 @@ from random import choice # kCOJ API import access # configurations -import config, promote +import config, promote, external bot = telepot.Bot(config.TOKEN) @@ -162,21 +162,27 @@ class kuser: def display_question(self, number, chat_id): self.status = 'ๆŸฅ็œ‹้กŒ็›ฎ' self.question = number - content = self.api.show_question(number) + if number in external.QUESTION: + ext_q = True + content = external.QUESTION[number] + else: + ext_q = False + content = '```\n' + self.api.show_question(number) + '\n```' q = self.api.list_questions()[number] q_str = "๐Ÿ’ *" + self.username + "* [" + config.NAME + "]\n" q_str += "โž–โž–โž–โž–โž–\n" q_str += "๐Ÿ“—" if q[1] == 'ๆœŸ้™ๆœชๅˆฐ' else "๐Ÿ“•" q_str += "*" + number + "* (DL: " + q[0] + ")\n [[[" + q[2] + "]]]" q_str += "โš ๏ธ" if q[2] == 'ๆœช็นณ' else "โœ…" - reply = bot.sendMessage(chat_id, q_str + "\n\n```\n" + content + "\n```", + reply = bot.sendMessage(chat_id, q_str + "\n\n" + content, parse_mode='Markdown', reply_markup=ReplyKeyboardMarkup(keyboard=[ ["้ฆ–้ ๐Ÿ ", "้กŒๅบซ๐Ÿ“"], ["ไบคไฝœๆฅญ๐Ÿ“ฎ" if q[1] == 'ๆœŸ้™ๆœชๅˆฐ' else '', "็œ‹็ตๆžœโ˜‘๏ธ" if q[2] == 'ๅทฒ็นณ' else '', "้€š้Ž่€…๐ŸŒ"], ["็™ปๅ‡บ๐Ÿšช", "ๆ”นๅฏ†็ขผ๐Ÿ’ฑ", "ๅนซๅŠฉ๐Ÿ“š"] ], resize_keyboard=True) if chat_id == self.userid else ReplyKeyboardRemove()) - bot.sendMessage(chat_id, "้ปžๆˆ‘ๅˆฐ้กŒ็›ฎ้ ‚", reply_to_message_id=reply['message_id']) + if ext_q == False: + bot.sendMessage(chat_id, "้ปžๆˆ‘ๅˆฐ้กŒ็›ฎ้ ‚", reply_to_message_id=reply['message_id']) def help_you(self): self.question = '้กŒๅค–'