PythonでSlack Bot

1a4bb4b2da22fbbe6c16b0b19562b5a7?s=47 anonaka
March 18, 2017

PythonでSlack Bot

SlackBot sample to make a phone call and read text.

1a4bb4b2da22fbbe6c16b0b19562b5a7?s=128

anonaka

March 18, 2017
Tweet

Transcript

  1. 1ZUIPOͰ4MBDL#PU ໺தɹ఩ 909;0ΤόϯδΣϦετ

  2. 8IPBN* w ۭඈͿϓϩάϥϚ w גࣜձࣾ909;0ΤόϯδΣϦετ

  3. None
  4. None
  5. "CPVU9PY[P κΫκʔʣ w ςϨϑΥχʔ"1*Λఏڙ͍ͯ͠·͢ w 909;0Ͱݕࡧͯ͠Ͷ

  6. None
  7. None
  8. %&.0

  9. #PU6TFST w 4MBDLͷ#PU6TFSΛ࡞੒͠ɺ"1*5PLFOΛೖख ͢Δ

  10. ४උ w QJQJOTUBMMTMBDLCPU w QJQJOTUBMMYPY[PDMPVEQZ w ʢి࿩Λ͔͚ΔϥΠϒϥϦʣ

  11. $ cat slack.py # -*- coding: utf-8 -*- import os

    from slackbot.bot import respond_to, listen_to from xoxzo.cloudpy import XoxzoClient sid = os.environ.get("XOXZO_API_SID") auth_token = os.environ.get("XOXZO_API_AUTH_TOKEN") @listen_to('(.*)ʹʮ(.*)ʯͱి࿩ͯ͠') def hello(message, phonnum, msg): message.reply('%sʹʮ%sʯͱి࿩͠·͢Ͷ' % (phonnum, msg)) xc = XoxzoClient(sid=sid, auth_token=auth_token) result = xc.call_tts_playback( tts_message=msg, tts_lang='ja', recipient="+81" + phonnum[1:], caller="+815012345678")
  12. 909;0ΞΧ΢ϯτ w "1*ͷར༻ʹ͸909;0ΞΧ΢ϯτʹαΠϯΞο ϓͯ͠ɺ4*%ͱΞΫηετʔΫϯͷೖख͕ඞཁͰ ͢ w IUUQTXXXYPY[PDPNKBBDDPVOUT TJHOVQ

  13. 909;0νʔϜ w ݱࡏ໊̔ w ΦϑΟε͸ͳ͠ɻશһϦϞʔτϫʔΫ

  14. None
  15. None
  16. ͝੩ௌͲ͏΋ ͋Γ͕ͱ͏͍͟͝·ͨ͠ "1*Λ࢖ͬͨ໘ന͍ΞΠσΞืूதͰ͢ʂ