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
prefix | body | description |
---|---|---|
amp-def |
def ${1:func_name}(sender_id, cmd, **extends):
${2:code...} |
|
amp-cmd |
@ampalibe.command(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...} |
|
amp-act |
@ampalibe.action(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...} |
|
amp-chat-sms |
chat.send_message(sender_id, ${1:sms}) |
|
amp-chat-sms-format |
chat.send_message(sender_id, f'${1:sms_format}') |
|
amp-chat-qckreply |
chat.send_quick_reply(sender_id, ${1:responses_buttons}, ${2:question}) |
|
amp-chat-sendlocal |
chat.send_file(sender_id, ${1:local_path}, filetype=${2:audio|video|file}) |
|
amp-chat-sendurl |
chat.send_file_url(sender_id, ${1:url}, filetype=${2:audio|video|file}) |
|
amp-chat-sendfb |
chat.send_media(sender_id, ${1:fb_url}, ${2:audio|video|file}) |
|
amp-import-nat-latest |
import ampalibe
from ampalibe import Model, Messenger
chat = Messenger()
query = Model()
chat.get_started() |
|
amp-import-nat |
import ampalibe
from conf import Configuration
bot = ampalibe.init(Configuration())
chat = bot.chat
query = bot.query
chat.get_started() |
|
amp-import-config |
from conf import Configuration as config |
|
amp-import-quickreply |
from ampalibe.ui import QuickReply |
|
amp-import-button |
from ampalibe.ui import Button |
|
amp-import-sendtemplate |
from ampalibe import Payload
from ampalibe.ui import Element, Button |
|
amp-pattern-credentials |
@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 |
|
amp-query-setact |
query.set_action(sender_id, ${1:'/route'}) |
|
amp-query-nullact |
query.set_action(sender_id, None) |
|
amp-query-settemp |
query.set_temp(sender_id, ${1:'data_key'}, cmd) |
|
amp-query-gettemp |
query.get_temp(sender_id, ${1:'data_key'}) |
|
amp-query-deltemp |
query.del_temp(sender_id, ${1:'data_key'},) |
|
amp-ui-button |
${1:button_name} = [
Button(
type='postback',
title=${2:titleValue},
payload=${3:route}
)
]
chat.send_button(sender_id, buttons, ${3:question}) |
|
amp-ui-persistent |
persistent_menu = [
Button(type='postback', title=${1:title_value}, payload=${2:route})
]
chat.persistent_menu(sender_id, persistent_menu) |
|
amp-ui-quickreply |
${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?'}) |
|