From 70317ddd10d94e7acc5db225cfef4790519168aa Mon Sep 17 00:00:00 2001 From: PinLin Date: Wed, 23 Aug 2017 21:41:37 +0800 Subject: [PATCH] random sentence --- bot.py | 2 -- interface.py | 9 ++++----- promote.py | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 promote.py diff --git a/bot.py b/bot.py index 093c988..2808e9c 100644 --- a/bot.py +++ b/bot.py @@ -101,8 +101,6 @@ def on_chat(msg): user.list_passers() elif command[0] == '回題目📜': user.display_question(user.question) - else: - bot.sendMessage(chat_id, "快去寫扣啦!") elif content_type == 'document': if user.status == '上傳答案' or user.status == '查看題目': diff --git a/interface.py b/interface.py index 1f1b212..ace749c 100644 --- a/interface.py +++ b/interface.py @@ -3,10 +3,11 @@ # necessary modules import os, requests, telepot from telepot.namedtuple import ReplyKeyboardMarkup, ReplyKeyboardRemove +from random import choice # kCOJ API import access # configurations -import config +import config, promote class kuser: def __init__(self, chat_id, bot): @@ -121,8 +122,7 @@ class kuser: if q_str == q_available: q_str = q_unavailable self.bot.sendMessage(self.chat_id, "💁 " + self.username + " /logout\n" - "➖➖➖➖➖\n" + q_str + "➖➖➖➖➖\n" - "你今天寫扣了嗎?", # todo + "➖➖➖➖➖\n" + q_str + "➖➖➖➖➖\n" + choice(promote.sentences), parse_mode='HTML', reply_markup=ReplyKeyboardMarkup(keyboard=[ ["題庫📝"], @@ -146,8 +146,7 @@ class kuser: self.bot.sendMessage(self.chat_id, "💁 " + self.username + " /logout\n" "➖➖➖➖➖\n" "📝所有作業\n\n" + q_str + \ - "➖➖➖➖➖\n" - "你今天寫扣了嗎?", # todo + "➖➖➖➖➖\n" + choice(promote.sentences), parse_mode='HTML', reply_markup=ReplyKeyboardMarkup(keyboard=[ ["首頁🏠", "更新🔃"], diff --git a/promote.py b/promote.py new file mode 100644 index 0000000..61a0ea6 --- /dev/null +++ b/promote.py @@ -0,0 +1,22 @@ +sentences = ["你今天寫扣了嗎?", + "郭老說過,零分很危險。", + "郭老說過,每天至少要花 1 小時練習寫程式。", + "GNOME > KDE,不服來戰。", + "天氣好的時候,天空是藍的。\n認同請分享", + "根據郭老的大數據分析,\n每年都會有 1/3 的同學必須跟學弟妹再修一次程設課", + "在非洲,每 60 秒過去就過了 1 分鐘。", + "多多參加系上活動程設課會加分哦!", + "來互相傷害啊。", + "我偏好使用 POSIX 相容的作業系統做開發。", + "你有用過 Windows 以外的作業系統嗎?", + "如果你想入門採用 Linux 的作業系統,\n建議你從 Ubuntu 或 Fedora 開始。", + "...", + "Yee", + "這是這個 Bot 的 GitHub 頁面:\nhttps://github.com/PinLin/kcoj_bot", + "你知道 CLI 與 GUI 的差別與各自的優缺點嗎?", + "bash 跟 cmd.exe 是天與地之間的差別,不服來戰。", + "編輯器的話,我用 Visual Studio Code 跟 VIM。", + "買一台 MacBook 是脫離 Windows 最簡單的方式。\n不過我個人很不推薦含 Touch Bar 的版本。", + "如果你對資訊真的抱有興趣的話,\n學生計算機年會 SITCON 你絕對不能錯過。\n", + "友情宣傳:台大開源社 NTUOSC 開放外校社員owo/\n在這裡你可以跟各式各樣的人一同研究資訊、推廣開源。", + "SITCON Telegram 群組:\nhttps://t.me/SITCONgeneral"] \ No newline at end of file