random sentence

This commit is contained in:
2017-08-23 21:41:37 +08:00
parent 29ffae8648
commit 70317ddd10
3 changed files with 26 additions and 7 deletions

2
bot.py
View File

@ -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 == '查看題目':

View File

@ -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, "💁 <b>" + self.username + "</b> /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, "💁 <b>" + self.username + "</b> /logout\n"
"\n"
"📝<i>所有作業</i>\n\n" + q_str + \
"\n"
"你今天寫扣了嗎?", # todo
"\n" + choice(promote.sentences),
parse_mode='HTML',
reply_markup=ReplyKeyboardMarkup(keyboard=[
["首頁🏠", "更新🔃"],

22
promote.py Normal file
View File

@ -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"]