prefix |
body |
description |
amp-def
|
def ${1:func_name}(sender_id, cmd, **extends):
${2:code...}
|
[basic]: Default function for ampalibe
|
amp-cmd
|
@ampalibe.command(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...}
|
[basic]: Create ampalibe command
|
amp-act
|
@ampalibe.action(${1:'/route'})
def ${2:func_name}(sender_id, cmd, **extends):
${3:code...}
|
[basic]: Create ampalibe action
|
amp-chat-sms
|
chat.send_message(sender_id, ${1:sms})
|
[chat]: Sends an SMS to the specified recipient
|
amp-chat-sms-format
|
chat.send_message(sender_id, f'${1:sms_format}')
|
[chat]: Sends an SMS to the specified recipient (format)
|
amp-chat-qckreply
|
chat.send_quick_reply(sender_id, ${1:responses_buttons}, ${2:question})
|
[chat]: create quick reply submit
|
amp-chat-sendlocal
|
chat.send_file(sender_id, ${1:local_path}, filetype=${2:audio|video|file})
|
[chat]: send local file to user
|
amp-chat-sendurl
|
chat.send_file_url(sender_id, ${1:url}, filetype=${2:audio|video|file})
|
[chat]: send URL file to user
|
amp-chat-sendfb
|
chat.send_media(sender_id, ${1:fb_url}, ${2:audio|video|file})
|
[chat]: send facebook file to user
|
amp-import-nat-latest
|
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
|
amp-import-nat
|
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
|
amp-import-config
|
from conf import Configuration as config
|
[deps]: Import config
|
amp-import-quickreply
|
from ampalibe.ui import QuickReply
|
[deps]: import quick reply deps
|
amp-import-button
|
from ampalibe.ui import Button
|
[deps]: import button deps
|
amp-import-sendtemplate
|
from ampalibe import Payload
from ampalibe.ui import Element, Button
|
[deps]: import send_template deps
|
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
|
[pattern]: Generate credentials pattern
|
amp-query-setact
|
query.set_action(sender_id, ${1:'/route'})
|
[query]: Points to a specific route according to the argument
|
amp-query-nullact
|
query.set_action(sender_id, None)
|
[query]: Point action to null
|
amp-query-settemp
|
query.set_temp(sender_id, ${1:'data_key'}, cmd)
|
[query]: Create/Modify temporary data
|
amp-query-gettemp
|
query.get_temp(sender_id, ${1:'data_key'})
|
[query]: Get temporary data
|
amp-query-deltemp
|
query.del_temp(sender_id, ${1:'data_key'},)
|
[query]: Delete temporary data
|
amp-ui-button
|
${1:button_name} = [
Button(
type='postback',
title=${2:titleValue},
payload=${3:route}
)
]
chat.send_button(sender_id, buttons, ${3:question})
|
[ui]: create button
|
amp-ui-persistent
|
persistent_menu = [
Button(type='postback', title=${1:title_value}, payload=${2:route})
]
chat.persistent_menu(sender_id, persistent_menu)
|
[ui]: create 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?'})
|
[ui]: create quickreply
|