�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l m Z d d
l
m Z d d l m Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
module: telegram
version_added: "2.2"
author: "Artem Feofanov (@tyouxa)"
short_description: module for sending notifications via telegram
description:
- Send notifications via telegram bot, to a verified group or user
notes:
- You will require a telegram account and create telegram bot to use this module.
options:
msg:
description:
- What message you wish to send.
required: true
msg_format:
description:
- Message format. Formatting options `markdown` and `html` described in
Telegram API docs (https://core.telegram.org/bots/api#formatting-options).
If option `plain` set, message will not be formatted.
default: plain
choices: [ "plain", "markdown", "html" ]
version_added: "2.4"
token:
description:
- Token identifying your telegram bot.
required: true
chat_id:
description:
- Telegram group or user chat_id
required: true
s�
- name: send a message to chat in playbook
telegram:
token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX'
chat_id: 000000
msg: Ansible task finished
s
msg:
description: The message you attempted to send
returned: success
type: str
sample: "Ansible task finished"
telegram_error:
description: Error message gotten from Telegram API
returned: failure
type: str
sample: "Bad Request: message text is empty"
N( t
AnsibleModule( t quote( t fetch_urlc C` s� t d t d t d d d t d t � d t d d d t d t � d t d d d t d d
d d
d d
g � d t d d d t � � d t � } t | j j d � � } t | j j d � � } t | j j d � � } t | j j d � � } d | d | d | } | d k r$| d | 7} n | j r@| j d t � n t | | � \ } } | d d k rx| j d t � n; t
j | d � } | j d d t
| d � d | d � d S( Nt
argument_spect tokent typet strt requiredt no_logt chat_idt
msg_formatt defaultt plaint choicest markdownt htmlt msgt supports_check_modes https://api.telegram.org/bots /sendMessage?text=s &chat_id=s &parse_mode=t changedR i� t bodys( failed to send message, return status=%st telegram_errort description( R R ( R t dictt Truet FalseR t paramst gett
check_modet exit_jsonR
t jsont loadst fail_jsonR ( t moduleR R R R t urlt responset infoR ( ( sI /usr/lib/python2.7/site-packages/ansible/modules/notification/telegram.pyt mainR s. t __main__( t
__future__R R R R
t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt RETURNR% t ansible.module_utils.basicR t+ ansible.module_utils.six.moves.urllib.parseR t ansible.module_utils.urlsR
R, t __name__( ( ( sI /usr/lib/python2.7/site-packages/ansible/modules/notification/telegram.pyt <module> s
% "
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]