VSCode extension for Ampalibe framework 🥝
MIT License
Ampalibe is a lightweight Python framework for building Facebook Messenger bots faster. It provides a new concept, it manages webhooks, processes data sent by Facebook and provides API Messenger with advanced functions such as payload management, item length, and more.
Ampalibe simplifies its utilization through a dedicated VSCode extension, encompassing a variety of code snippets.
Usage: You can install it by typing "Ampalibe" in the extension tab of your IDE
def ${1:func_name}(sender_id, cmd, **extends):
${2:code...}
[basic]: Default function for ampalibe
@ampalibe.command(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...}
[basic]: Create ampalibe command
@ampalibe.action(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...}
[basic]: Create ampalibe action
chat.send_message(sender_id, ${1:sms})
[chat]: Sends an SMS to the specified recipient
chat.send_message(sender_id, f'${1:sms_format}')
[chat]: Sends an SMS to the specified recipient (format)
chat.send_quick_reply(sender_id, ${1:responses_buttons}, ${2:question})
[chat]: create quick reply submit
chat.send_file(sender_id, ${1:local_path}, filetype=${2:audio|video|file})
[chat]: send local file to user
chat.send_file_url(sender_id, ${1:url}, filetype=${2:audio|video|file})
[chat]: send URL file to user
chat.send_media(sender_id, ${1:fb_url}, ${2:audio|video|file})
[chat]: send facebook file to user
import ampalibe
from ampalibe import Model, Messenger
chat = Messenger()
query = Model()
chat.get_started()
[deps]: version>=1.1.4 - Import the native module for ampalibe
import ampalibe
from conf import Configuration
bot = ampalibe.init(Configuration())
chat = bot.chat
query = bot.query
chat.get_started()
[deps]: version<=1.0.7 - Import the native module for ampalibe
from conf import Configuration as config
[deps]: Import config
from ampalibe.ui import QuickReply
[deps]: import quick reply deps
from ampalibe.ui import Button
[deps]: import button deps
from ampalibe import Payload
from ampalibe.ui import Element, Button
[deps]: import send_template deps
@ampalibe.command(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **ext):
chat.send_message(sender_id, ${3:'Enter your mail'})
query.set_action(sender_id, ${4:'/get_mail'})
@ampalibe.action(${4:'/get_mail'})
def ${5:get_mail}(sender_id, cmd, **ext):
query.set_temp(sender_id, 'mail', cmd)
chat.send_message(sender_id, ${6:'Enter your password'})
query.set_action(sender_id, ${7:'/get_password'})
@ampalibe.action(${7:'/get_password'})
def ${8:get_password}(sender_id, cmd, **ext):
query.set_action(sender_id, None)
${9:'mail'} = query.get_temp(sender_id, ${9:'mail'})
${10:'password'} = cmd
[pattern]: Generate credentials pattern
query.set_action(sender_id, ${1:'/route'})
[query]: Points to a specific route according to the argument
query.set_action(sender_id, None)
[query]: Point action to null
query.set_temp(sender_id, ${1:'data_key'}, cmd)
[query]: Create/Modify temporary data
query.get_temp(sender_id, ${1:'data_key'})
[query]: Get temporary data
query.del_temp(sender_id, ${1:'data_key'},)
[query]: Delete temporary data
${1:button_name} = [
Button(
type='postback',
title=${2:titleValue},
payload=${3:route}
)
]
chat.send_button(sender_id, buttons, ${3:question})
[ui]: create button
persistent_menu = [
Button(type='postback', title=${1:title_value}, payload=${2:route})
]
chat.persistent_menu(sender_id, persistent_menu)
[ui]: create persistent menu
${1:quick_rep_name} = [
QuickReply(
title=${2:'Angela'},
payload=Payload(${3:'/route'}, name=${2:'Angela'}, ref=${4:'id'})
),
QuickReply(
title=${5:'Rivo'},
payload=Payload(${6:'/route'}, name=${5:'Rivo'}, ref=${7:'id'})
)
]
chat.send_quick_reply(sender_id, ${1:quick_rep_name}, ${8:'Question?'})
[ui]: create quickreply