Skip to content

Instantly share code, notes, and snippets.

Avatar

MINKANG MKtalk

View GitHub Profile
@MKtalk
MKtalk / downloader.py
Created Apr 16, 2020
file downloader
View downloader.py
#-*- coding:utf-8 -*-
import urllib.request
import uuid
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Pool
def get_image(url):
filename = str(uuid.uuid4())
out = f'./download/{filename}.jpg'
View bot.py
from bothub_client.bot import BaseBot
from bothub_client.decorators import channel
class Bot(BaseBot):
@channel()
def default_handler(self, event, context):
self.send_message('Echo: {}'.format(event['content']))
@MKtalk
MKtalk / google_form.py
Created Aug 17, 2018
구글 설문지 정보 가져오기
View google_form.py
# -*- coding: utf-8 -*-
import json
import re
import requests
base_url = 'https://docs.google.com/forms/d/1Zf-XM4WWG_6xisG83W8SQY2MueXEZzStPl9xiNH25u4'
response = requests.get(base_url).text
@MKtalk
MKtalk / bot.py
Created Aug 17, 2018
간단한 설문 조사 챗봇과 구글 설문지 연동
View bot.py
def set_pools(self, event, context, **kwargs):
q1 = kwargs.get('question1') # slots id 와 대응
q2 = kwargs.get('question2')
form_url = 'https://docs.google.com/forms/d/e/1FAIpQLScsCKP5Arszf84igEzoL5Yrbr5qcZIND9a4NeJyNw_onUUavw/formResponse'
params = '?entry.1894278833={}&entry.281957015={}'.format(q1, q2)
url = form_url + params
requests.post(url)
msg = '설문이 등록 되었습니다.'.format(q1, q2)
self.send_message(msg)
@MKtalk
MKtalk / bot.py
Last active Sep 7, 2018
간단한 설문 조사 챗봇을 위한 코드 구현
View bot.py
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from bothub_client.bot import BaseBot
from bothub_client.messages import Message
from bothub_client.decorators import command, intent
class Bot(BaseBot):
@MKtalk
MKtalk / bothub.yml
Created Aug 16, 2018
간단한 설문 챗봇을 위한 YML 구성
View bothub.yml
programming-language: python3
intents:
pools:
slots:
- id: question1
question: 오늘 점심은 어떤걸 드셨나요?
options:
- '자장면'
- '돈가스'
- '냉면'
@MKtalk
MKtalk / html-style.py
Last active Jan 29, 2018
bothub-sdk 0.1.27 html style
View html-style.py
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from bothub_client.bot import BaseBot
from bothub_client.messages import HTML
from bothub_client.messages import Markdown
from bothub_client.messages import Message
@MKtalk
MKtalk / markdown.py
Last active Jan 29, 2018
bothub-sdk 0.1.27 - Markdown 적용
View markdown.py
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function, unicode_literals)
from bothub_client.bot import BaseBot
from bothub_client.messages import Markdown
from bothub_client.messages import Message
class Bot(BaseBot):
@MKtalk
MKtalk / nmt-bot.py
Created Jan 25, 2018
네이버 파파고 번역 챗봇 만들기 튜토리얼 https://goo.gl/78wqLE
View nmt-bot.py
from bothub_client.bot import BaseBot
from .nmt import Translate
class Bot(BaseBot):
def handle_message(self, event, context):
message = event.get('content')
if message == '/start':
self.send_start_message()
else:
@MKtalk
MKtalk / nmt.py
Created Jan 25, 2018
네이버 파파고 번역 챗봇 만들기 튜토리얼 https://goo.gl/78wqLE
View nmt.py
import os
import sys
import json
from urllib.request import Request
from urllib.request import urlopen
from urllib.parse import quote
class Translate(object):
base_url = 'https://openapi.naver.com/v1'
You can’t perform that action at this time.