Simple framework for building Instagram chat bots with menu driven interface
Project description
instachatbot
Simple framework for building Instagram chat bots with menu driven interface
Installation
pip install git+https://github.com/art-vasilyev/instachatbot.git
How to use
Create sample script main.py
:
from instachatbot.bot import InstagramChatBot
from instachatbot.nodes import (
MenuNode, MenuItem, MessageNode, QuestionnaireNode, NotifyAdminNode)
menu = MenuNode(
'💡Choose menu:\n',
[
MenuItem(
'text message',
MessageNode('This is a message😀')),
MenuItem(
'questionnaire',
QuestionnaireNode(
[
'What is your favourite book? 📚',
'What is your favourite fruit? 🍐 🍊 🍋'
],
header='Please answer the following questions',
admin_username='<user to send results to>',
response='Thank your for your answers')),
MenuItem(
'send notification to admin',
NotifyAdminNode(
'Thank you',
notification='Sample notification from bot user',
admin_username='<username to send notification to>'
)
),
],
error_message='Failed to select menu.'
)
chatbot = InstagramChatBot(menu=menu)
chatbot.login(
username='<instagram-username>',
password='<instagram-password>')
chatbot.start()
Run the script:
python3.6 main.py
Persistent conversation state
By default conversation state is discarded on bot restart, to make it persistent you should provide persistent storage on bot initialization:
chatbot = InstagramChatBot(menu=menu, storage=FileStorage())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
instachatbot-0.3.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for instachatbot-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d459290fddacaeda1d470242f468a49ad10008941393d796e1cdf35051ce4d2b |
|
MD5 | c5b107f7c6219e9b94779811d3967a5e |
|
BLAKE2b-256 | 2d7f97eaf10d3d6b53db509f5cd3000549bab6cc9b9904cae4373f2ffc5b6145 |