INNER CODE UNIT · Python
add
TechXueXi/TechXueXi · SourcePackages/telegramListener.py:81
def add(message):
bot.send_chat_action(master, "typing")
pdl.add_user()
@bot.message_handler(commands=['update'], func=authorize)
def rep_update(message):
try:
shell = "git -C /xuexi/code/TechXueXi pull $Sourcepath $pullbranche "
params = message.text.split(" ")
if len(params) > 1:
shell += params[1]
msg = os.popen(shell).readlines()[-1]
if "up to date" in msg:
bot.send_message(message.chat.id, "当前代码已经是最新的了")
else:
os.popen("cp -r /xuexi/code/TechXueXi/SourcePackages/* /xuexi")
bot.send_message(message.chat.id, "代码更新完成"+msg)