- module adapters
- module adapters.shopee_imbot
- module adapters.sop_bot
- module adapters.sop_bot.events
- module adapter
- module configs
- module configs.startup_config
- module core
- module hooks
- module hooks.bot_lifecycle
- module hooks.matcher
- module libs
- module libs.seatalk_openapi
- module libs.seatalk_openapi.client
- module libs.seatalk_webhook
- module libs.seatalk_webhook.client
- module log
- module models
- module models.config
- module models.database
- module permissions
- module plugin
- function filter_matchers
- class ConfigUpdateCallback
- class PluginLifecycle
- class PluginAPI
- class Plugin
- class PluginManager
- classmethod export
- classmethod get_config
- classmethod get_plugin_by_name
- classmethod load_plugin
- classmethod on_any
- classmethod on_config_updated
- classmethod on_exact
- classmethod on_image
- classmethod on_keyword
- classmethod on_plugin_loaded
- classmethod on_plugin_unloaded
- classmethod on_prefix
- classmethod on_regex
- classmethod register_plugin_api
- module protocol
- module role
- module rule
- module scheduler
- module session
- module store
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__init__(bot: 'CSBot', config: Dict[str, Any])
extract_event(
raw_body: bytes,
headers: Dict[str, str]
) → Optional[CallbackMessage]
get_response(raw_body: bytes, headers: Dict[str, str]) → Any
reply(event: EventChatMessage, message: Message, quote_reply: bool = False)
send(receiver_email: str, message: Message)
send_group(
group_name: str,
message: Message,
mentioned_emails: Optional[List[str]] = None
)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
OnMessage callback request definition, used to deserialize the callback requests from the shopee_imbot callback server
Adapter implement to adapt the shopee_imbot callback server
__init__(bot: 'CSBot', config: Dict[str, Any])
encoded_content(message: Message)
extract_event(
raw_body: bytes,
headers: Dict[str, str]
) → Optional[CallbackMessage]
shopee-imbot has only one EventType: EventType.NEW_CHAT_MESSAGE :param raw_body: :param headers: :return:
get_response(raw_body: bytes, headers: Dict[str, str]) → Any
reply(event: EventChatMessage, message: Message, quote_reply: bool = False)
send(receiver_email: str, message: Message)
send_group(
group_name: str,
message: Message,
mentioned_emails: Optional[List[str]] = None
)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__init__(bot: 'CSBot', config: Dict[str, Any])
Initialize the SOP Bot Adapter :param bot: CSBot instance :param config: StartupConfig.adapter
extract_event(
raw_body: bytes,
headers: Dict[str, str]
) → Optional[CallbackMessage]
https://open.seatalk.io/docs/messaging_messaging-events extract event from the callback request of the Seatalk Open Platform. :param raw_body: http body :param headers: http headers :rtype: protocol.CallbackMessage
get_response(raw_body: bytes, headers: Dict[str, str]) → Any
:return: HTTP Response to return
get_user_info(employee_codes: List[str]) → Dict[str, UserInfo]
get UserInfo by the employee_code :param employee_codes: employee_code of the Seatalk Open Platform :return: the respective user info
reply(event: CallbackMessage, message: Message, quote_reply: bool = False)
Let the bot reply a message :param quote_reply: whether to quote the incoming message, not supported yet :param event: the origin event to reply :param message: the reply :return: None :raise: raise ValueError on invalid input message
send(receiver_email: str, message: Message)
let the bot send a message :param receiver_email: email :param message: Message Instance :return: None :raise: raise ValueError on invalid input message
send_group(
group_name: str,
message: Message,
mentioned_emails: Optional[List[str]] = None
)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
EventType definition of the Event Callback from Seatalk Open Platform. See details in https://open.seatalk.io/docs/messaging_messaging-events .
TextMessage definition. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Message definition. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Event Definition of the Callback Event <message_from_bot_subscriber>. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Event Definition of the Callback Event <new_bot_subscriber>. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Event Definition of the Callback Event <event_verification>. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Common Fields of the Event Callback Request. See details in https://open.seatalk.io/docs/messaging_messaging-events .
Event Callback Request definition See details in https://open.seatalk.io/docs/messaging_messaging-events .
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- API_AUTH_KEY
standard_response(
code: int = 0,
error: Any = '',
data: Any = None,
status: int = 200
) → Response
plugin_not_found(plugin_name: str) → Response
plugin_not_enabled(plugin_name: str) → Response
plugin_config_invalid(errors: Optional[List])
plugin_api_not_found(plugin_name: str, api_path: str, method: str) → Response
plugin_api_auth_required(
plugin_name: str,
api_path: str,
method: str
) → Response
plugin_api_no_permission(
plugin_name: str,
api_path: str,
method: str,
role_required: APIAuth
) → Response
plugin_api_internal_error(trace: str) → Response
An enumeration.
__init__(is_authenticated: bool, user: Optional[str], auth_role: APIAuth)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- DEFAULT_STARTUP_CONFIG
DBConfig address: address to the database mysql: TODO sqlite: sqlite://path_to_your_db.db
driver: "mysql" or "sqlite" are available
RedisConfig
Startup Config definition of the CSBot
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__init__(config: Optional[StartupConfig] = None)
get_app()
on_event()
register_adapter(adapter: BaseAdapter)
run(host: str, port: int)
Runs the application on a local development server. :return: None
__init__(
config: Optional[StartupConfig] = StartupConfig(db=DBConfig(database='cs_bot.db', port=0, host='127.0.0.1', user='', password='', driver='sqlite', need_migration=False), redis=RedisConfig(host='127.0.0.1', port=6379, db=0), jwt_secret='', adapter={}, callback_path='/callback', signing_secret='', max_scheduler_workers=4, max_msg_handler_workers=32, owner_emails=[], developers=[], webhooks=[], debug=False)
)
get_app()
get_fsm(key: Union[str, Type[ForwardRef('State')]]) → FSM
on_event()
register_adapter(adapter: BaseAdapter)
register_fsm(fsm_name: str, state_class: Type[ForwardRef('State')]) → FSM
reply(
event: EventChatMessage,
message: Union[str, Message],
quote_reply: bool = False
)
run(host: str, port: int)
Runs the application on a local development server. :return: None
send(receiver_email: Union[str, List[str]], message: Union[str, Message])
send_group(
group_name: str,
message: Union[str, Message],
mentioned_emails: Optional[List[str]] = None
)
webhook(
message: Union[str, bytes],
msg_type: WebhookMsgType = <WebhookMsgType.TEXT: 'text'>
)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
md5(v: str) → str
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
BotLifecycle
__init__()
emit_startup()
Emit the init event, iterate all the callback functions and call. :return: None
on_startup() → Callable[[], Callable[, NoneType]]
on_init :return: a decorator to use to register an bot initialization callback :rtype: LifecycleHook_D
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Base Matcher Definition A matcher has 3️ duties 1⃣️ To tell whether the session matches the rule. 2⃣️ To tell whether the session.role has permission to trigger the message process procedure. 3⃣️ Process the message.
__init__(
rule: Callable[[ForwardRef('Session')], bool],
permission: Optional[Permission],
priority: int,
processor: Callable[[ForwardRef('MessageSession')], NoneType]
)
init a new matcher / message process procedure :param rule: A function to tell whether a matcher is matched with the input session. :param permission: Used to judge whether a session has the permission to trigger a specified matcher. :param priority: priority decides the execution order of all matched matchers. :param processor: the function to call to process the incoming session.
process(session: MessageSession)
Process the incoming session, where the real logic should be set :param session: the incoming session :return: None
test(session: MessageSession) → bool
tell whether the session match the current matcher :param session: the incoming session :return: True on matched otherwise False
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- API_GET_ACCESS_TOKEN
- API_GET_CONTACT_PROFILE_V2
- API_SEND_SINGLE_CHAT
- API_GET_EMPLOYEE_CODE_WITH_EMAIL_V2
- API_SEND_SERVICE_NOTICE
- API_GET_DEPARTMENT_EMPLOYEES
- API_GET_DEPARTMENTS
- OK
- ACCESS_TOKEN_EXPIRED
- RATE_LIMIT
- SECRET_INVALID
__init__(path: str, method: str)
Client implementation for the SeaTalk Open Platform Server API. See details in https://open.seatalk.io/docs/api-development-guide_
__init__(app_id: str, app_secret: str, company_key: str = '')
get_access_token()
get_contact_profile_v2(employee_code_list: List[str]) → ContactProfiles
Use this API to obtain an employee's basic profile information. See details in https://open.seatalk.io/docs/get-employee-profile :param employee_code_list: a list of employee codes :return: ContactProfiles instance contains profiles of all the valid and scoped employees.
get_employee_code_with_email(emails: List[str]) → Dict[str, str]
Use this API to exchange a user's email for employee_code. Only employee whose status is in-position(2) would be returned by this method. See details in https://open.seatalk.io/docs/get-employee-code-with-email. :param emails: emails to exchange :return: A dict, email as the key and the respective employee_code as the value.
refresh_access_token()
Get app access token, see details in https://open.seatalk.io/docs/get-app-access-token :return: None
request(
api: API,
json: Dict = None,
query: Dict = None,
with_auth_header: bool = True
) → Dict
send_group_chat_message(
group_code: str,
content: Union[str, bytes],
content_type: str = 'text',
mention_all: bool = False,
mentioned_emails: Optional[List[str]] = None,
mentioned_employee_codes: Optional[List[str]] = None
)
send_service_notice(
employee_codes: List[str],
messages: Dict[str, ServiceNoticeMessage],
default_language: str = ''
) → Dict[str, str]
See details in https://open.seatalk.io/docs/messaging_send-service-notice_i18n
send_single_chat_message(
employee_code: str,
content: Union[str, bytes],
content_type: str = 'text'
)
Let the bot send a single chat message to its subscriber. See details in https://open.seatalk.io/docs/messaging_send-message-to-bot-subscriber_ :param employee_code: target employee_code :param content: message content :param content_type: "text" and the "markdown" are available :return: None
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
An enumeration.
__init__(webhooks: List[str])
send(
message: Union[str, bytes],
msg_type: WebhookMsgType = <WebhookMsgType.TEXT: 'text'>
)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- logging: # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
Failed to generate docs for module metrics: ValueError("Duplicated timeseries in CollectorRegistry: {'cs_bot_message_handled_sum', 'cs_bot_message_handled', 'cs_bot_message_handled_count', 'cs_bot_message_handled_bucket', 'cs_bot_message_handled_created'}")
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- TABLE_NAME_MAPPING
table_name(model_class: Type[Model])
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
get_db() → DatabaseProxy
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- OWNER
- DEVELOPER
- ANYONE
Permission is a rule to determined whether a message can trigger the specified Matcher.
__init__(policy: Callable[[ForwardRef('Session')], bool])
allow(session: MessageSession) → bool
this method would be called to test whether the session has the permission to trigger the Matcher procedure. :param session: the incoming session to be tested :return: a bool value indicate the session has the permission or not
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
filter_matchers(sess: MessageSession) → List[Matcher]
__init__(
f: Callable[[Type[ForwardRef('Config')]], NoneType],
immediate: bool = False
)
__init__()
emit_config_updated(new, is_init: bool = False)
emit_on_load()
emit_on_unload()
on_load() → Callable[[], Callable[, NoneType]]
on_plugin_config_update(
immediate: bool = False
) → Callable[[Callable[[Type[ForwardRef('Config')]], NoneType]], Callable[[Type[ForwardRef('Config')]], NoneType]]
on_unload() → Callable[[], Callable[, NoneType]]
__init__(handler: Callable[, Any], auth_role: APIAuth)
__init__(
module: module,
name: str,
lifecycle: PluginLifecycle,
custom_api: Dict[str, Dict[str, PluginAPI]],
config_class: Optional[Type[ForwardRef('Config')]],
config,
config_auto_sync: bool,
exported_functions: Dict[str, Callable[[], Any]]
)
get_api_handler(api_path: str, method: str) → Optional[PluginAPI]
get_exported_func(function_name: str) → Optional[Callable[[], Any]]
setup_auto_sync_lock()
to_json() → Dict
update_config(new_config: Dict) → None
export(
alias: Optional[str] = None
) → Callable[[Callable[[], Any]], Callable[[], Any]]
get_config(plugin_name: str) → Optional[Type[ForwardRef('Config')]]
get_plugin_by_name(plugin_name: str) → Optional[Plugin]
load_plugin(module_path: str) → Optional[Plugin]
on_any(permission: Optional[Permission], priority: int)
on_config_updated(immediate: bool = False) → Callable[[Callable], Callable]
on_exact(
pattern: Union[str, List[str]],
permission: Optional[Permission],
priority: int
)
on_image(permission: Optional[Permission], priority: int)
on_keyword(
keyword: Union[str, List[str]],
permission: Optional[Permission],
priority: int
)
on_plugin_loaded() → Callable[[Callable], Callable]
on_plugin_unloaded() → Callable[[Callable], Callable]
on_prefix(
prefix: Union[str, List[str]],
permission: Optional[Permission],
priority
) → Callable[[Callable[[ForwardRef('MessageSession')], NoneType]], Callable[[ForwardRef('MessageSession')], NoneType]]
on_regex(
pattern: Union[str, List[str]],
permission: Optional[Permission],
priority: int
)
register_plugin_api(
path: str,
methods: List[str],
auth_role: APIAuth = <APIAuth.Anonymous: 0>
) → Callable[[Callable[, Any]], Callable[, Any]]
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
An enumeration.
An enumeration.
An enumeration.
__init__(
content: Union[str, bytes],
msg_type: MsgType = <MsgType.TEXT: 'text'>,
**kwargs
)
pass
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__init__(bot: 'CSBot', user_info: UserInfo)
extract_from(bot: 'CSBot', event: CallbackMessage)
is_developer() → bool
is_owner() → bool
__init__(bot: 'CSBot', user_info: UserInfo)
extract_from(bot: 'CSBot', event: CallbackMessage)
is_developer() → bool
is_owner() → bool
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
rule_template(
word: Union[str, List[str]],
f: Callable[[List[str], str], bool]
) → Callable[[ForwardRef('Session')], bool]
rule_on_prefix(
prefix: Union[str, List[str]]
) → Callable[[ForwardRef('Session')], bool]
rule_on_regex(
regex: Union[str, List[str]]
) → Callable[[ForwardRef('Session')], bool]
rule_on_keyword(
keyword: Union[str, List[str]]
) → Callable[[ForwardRef('Session')], bool]
rule_on_exact(
keyword: Union[str, List[str]]
) → Callable[[ForwardRef('Session')], bool]
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__init__(background_workers: int = 16)
:return: Number of seconds until :meth:next_run <Scheduler.next_run>
or None if no jobs are scheduled
Datetime when the next job should run.
:return: A :class:~datetime.datetime
object or None if no jobs scheduled
every(interval: int = 1) → Job
run_pending()
__init__(interval: int, scheduler: Scheduler = None)
:return: True
if the job should be run now.
at(time_str)
background_job_wrapper(f: Callable) → Callable
block_do(job_func: Callable, *args, **kwargs)
do(job_func: Callable, *args, **kwargs)
once(job_func: Callable, *args, **kwargs)
tag(*tags: Hashable)
to(latest: int)
until(until_time: Union[datetime, timedelta, time, str])
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
An enumeration.
__init__(bot: 'CSBot', fsm_name: str, state_class: Type[ForwardRef('State')])
clear_state(customer_email: str) → Tuple[Optional[State], bool]
Reset the state to the default_state for the specified user :param customer_email: email :return: Tuple (previous_state, removed or not)
get_state(custom_email: str) → <enum 'State'>
handle_time_out() → Callable[[Callable[[str, ForwardRef('State')], Optional[Tuple[ForwardRef('State'), int]]]], Callable[[str, ForwardRef('State')], Optional[Tuple[ForwardRef('State'), int]]]]
maintain_states()
remove_expired_states() → Iterable[Tuple[str, State]]
Remove all the timeout states from the ZSET and trigger the FSM timeout handler. :return: an Iterable object of Tuple (email: str, previous_state: State)
state_key(email: str) → str
store_state(customer_email: str, state: State, timeout: int)
__init__(
bot: 'CSBot',
event: CallbackMessage,
session_manager: 'SessionManager'
)
abort()
stop()
__init__(
bot: 'CSBot',
event: CallbackMessage,
session_manager: 'SessionManager'
)
abort()
get_state(state_class: Union[Type[ForwardRef('State')], str]) → State
reply(message: Union[str, Message], quote_reply: bool = False)
send(receiver_email: Union[str, List[str]], message: Union[str, Message])
stop()
__init__(bot: 'CSBot', cm: CallbackMessage, session_manager: 'SessionManager')
abort()
stop()
__init__(cache_manager: CacheManager)
Copyright 2022 SeaTalk Open Platform
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- TABLE_NAME_MAPPING
delete(key: str) → bool
get(key: str) → Optional[str]
init(config: DBConfig)
init_migration()
range(
start_key: str,
end_key: str,
include_start_key: bool = True,
include_end_key: bool = True
) → Iterable[Tuple[str, str]]
set(key: str, value: str)