ソースを参照

Create Darkside

Bot WhatsApp
pull/3748/head
DpmX996eBCMsi 3ヶ月前
committed by GitHub
コミット
2d4e39a017
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: B5690EEEBB952194
1個のファイルの変更25行の追加0行の削除
  1. +25
    -0
      Darkside

+ 25
- 0
Darkside ファイルの表示

@@ -0,0 +1,25 @@


```python
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse

app = Flask(__name__)

@app.route("/whatsapp", methods=['POST'])
def whatsapp_bot():
incoming_msg = request.values.get('Body', '').lower()
resp = MessagingResponse()
msg = resp.message()

if 'bonjour' in incoming_msg:
msg.body("Bonjour ! Comment puis-je t'aider ?")
elif 'aurevoir' in incoming_msg:
msg.body("Au revoir ! Passe une excellente journée !")
else:
msg.body("Désolé, je ne comprends pas cette commande. Essaye encore.")

return str(resp)

if __name__ == "__main__":
app.run(sage est reçu, le bot !

読み込み中…
キャンセル
保存