Frontend (3.5)

  1. Survey (google form 重新訂一個)
  2. Roadmap
  3. HTTP/HTML/CSS google slide [取用請告知/please notify when utilize the slide]
  4. jsfiddle practices

Backend (4.5)

  1. Roadmap - backend
  2. python init (prepare evnrionment) - installation
  3. notebook installation - colab
  4. software engineering [取用請告知/please notify when utilize the slide]
  5. devop roadmap

Javascript (3.5)

  1. introduction of javascript [取用請告知/please notify when utilize the slide]
  2. react or javascript? (二選一)
  3. react demo
  4. javascript introduction

API (4.5)

  1. curl
  2. restapi
  3. python - telegram-bot demo/practices (二選一)
  4. or fastapi demo/practices

7/2 下午的 example

from telegram import Update, ForceReply
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
import requests
from bs4 import BeautifulSoup

# 設定 token
token = '1692580256:AAG-SNcg3I3QMisbwyUkkorugs9c2F0LmJ4'
print('the real token is : {}'.format(token))
# 初始化bot

def start(update: Update, context: CallbackContext) -> None:
    """
    Send a message when the command /start is issued. (註解)
    """
    user = update.effective_user
    print('user: {}'.format(user))
    print('user.mention_markdown_v2(): {}'.format(user.mention_markdown_v2()))
    update.message.reply_text('神仙難救閃尿')

def echo(update: Update, context: CallbackContext) -> None:
    """Echo the user message."""
    try:
        if '幹' in update.message.text:
            update.message.reply_text('不要罵髒話')
        elif '病毒' in update.message.text and '中' in update.message.text:
            update.message.reply_text('我好害怕')
        elif '命' in update.message.text:
            update.message.reply_dice()
        elif '網' in update.message.text:
            update.message.reply_html('<a href="https://blog.robertiv.org/ke-cheng-outlines.html">Jordan B. Peterson</a>')
        elif '你在哪' == update.message.text:
            update.message.reply_location(23.51350067780124, 121.69511872542803)
        elif '疑' in update.message.text:
            update.message.reply_poll('你是超人嗎',  ['是', '假的', '普通超人'])
        elif '熱賣' == update.message.text:
            # r = requests.get('https://shopping.pchome.com.tw/')
            # soup = BeautifulSoup(r.text, 'html.parser')
            # mydivs = soup.find_all("div", {"class": "stylelistrow"})
            # #WelcomeContainer > dl > dd.body > ul > li > div > h6 > strong > i
            # soup.select_one('div#events-horizontal')
            # pis = soup.find_all("a", {"class": "prod_img"})
            # print('pis:  {}'.format(pis))
            r = requests.get('https://tw.stock.yahoo.com/')
            soup = BeautifulSoup(r.text, 'html.parser')
            k =  soup.find_all("div", {"class": "D(f) Ai(fe) Jc(fe)"})
            update.message.reply_text(k[0].get_text())
        elif '出包' == update.message.text:
            update.message.reply_text('value: {}'.format(100/0))
        else:
            update.message.reply_text(update.message.text)
    except BaseException as ex:
        print('error: {}'.format(ex))

updater = Updater(token)

# Get the dispatcher to register handlers
dispatcher = updater.dispatcher

# on different commands - answer in Telegram
dispatcher.add_handler(CommandHandler("start", start))

# on non command i.e message - echo the message on Telegram
dispatcher.add_handler(MessageHandler(Filters.text & ~Filters.command, echo))

# Start the Bot
updater.start_polling()

# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()


Comments

comments powered by Disqus