This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.bot import BaseBot | |
| from bothub_client.messages import Message | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| content = event['content'] | |
| self.count_word(content) | |
| self.search_word(event) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.bot import BaseBot | |
| from bothub_client.messages import Message | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| content = event['content'] | |
| self.search_word(event) | |
| def search_word(self, event): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.bot import BaseBot | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| self.send_message('Echo: {}'.format(event['content'])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bot(BaseBot): | |
| def list_droplets(self, event): | |
| d = DigitalOcean(self.api_key()) | |
| droplets = d.simplify(d.get_droplets()) | |
| if not droplets: | |
| self.send_message('No Droplet exists.') | |
| return | |
| for droplet in droplets: | |
| msg = Message(event).set_text('id: {} name: {} status: {}'\ | |
| .format(droplet['id'],\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| message = event.get('content') | |
| if message == '/start': | |
| self.set_start_message(event) | |
| elif message == 'Create Droplet': | |
| self.set_image(event) | |
| elif message == 'List all Droplets': | |
| self.list_droplets(event) | |
| elif message.startswith('/delete '): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.bot import BaseBot | |
| from bothub_client.messages import Message | |
| from .doapi import DigitalOcean | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| message = event.get('content') | |
| if message == '/start': | |
| self.set_start_message(event) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from urllib.error import HTTPError | |
| from urllib.parse import urlencode | |
| from urllib.request import Request | |
| from urllib.request import urlopen | |
| class DigitalOcean(object): | |
| base_url = 'https://api.digitalocean.com/v2/droplets' | |
| def __init__(self, api_key): | |
| self.headers = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.messages import Message | |
| from .movies import BoxOffice | |
| from .movies import LotteCinema | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| message = event.get('content') | |
| location = event.get('location') | |
| if location: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.messages import Message | |
| from .movies import BoxOffice | |
| from .movies import LotteCinema | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| message = event.get('content') | |
| location = event.get('location') | |
| if location: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bothub_client.messages import Message | |
| from .movies import BoxOffice | |
| from .movies import LotteCinema | |
| class Bot(BaseBot): | |
| def handle_message(self, event, context): | |
| message = event.get('content') | |
| location = event.get('location') | |
| if location: |