Last active
August 21, 2017 07:58
-
-
Save toracle/dfee51d31a893141d4637912d2d3ed00 to your computer and use it in GitHub Desktop.
bothub-tutorial-wordbook-2
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) | |
| def count_word(self, word): | |
| data = self.get_user_data() | |
| data.setdefault(word, 0) | |
| data[word] += 1 | |
| self.set_user_data(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment