Модуль community.general.discord — Отправка сообщений в Discord
Примечание
Этот модуль является частью коллекции community.general (версия 9.5.0).
Возможно, эта коллекция уже установлена, если вы используете пакет ansible. Она не включена в ansible-core. Чтобы проверить, установлена ли она, выполните ansible-galaxy collection list.
Для установки используйте: ansible-galaxy collection install community.general.
Чтобы использовать её в плейбуке, укажите: community.general.discord.
Новое в community.general 3.1.0
Описание
- Отправляет сообщение в канал Discord с помощью API Discord webhook.
Параметры
Параметр | Комментарии |
|---|---|
avatar_url строка | Заменяет значение по умолчанию для аватара webhook. |
content строка | |
embeds список / элементы=словарь | Отправка сообщений в виде вложений в канал Discord. Вложения могут иметь цветную рамку, встроеные изображения, текстовые поля и многое другое. Допустимые параметры описаны в документации Discord: https://discord.com/developers/docs/resources/channel#embed-object |
tts логический | Установите значение Варианты:
|
username строка | Заменяет значение по умолчанию для имени пользователя webhook. |
webhook_id строка / обязательно | Идентификатор webhook. Формат из URL webhook Discord: |
webhook_token строка / обязательно | Токен webhook. Формат из URL webhook Discord: |
Атрибуты
Атрибут | Поддержка | Описание |
|---|---|---|
check_mode | Поддержка: полная | Может работать в режиме |
diff_mode | Поддержка: нет | Вернет подробности о том, что изменилось (или, возможно, нужно изменить в |
См. также
См. также
- Документация API
-
Документация API Discord
Примеры
- name: Send a message to the Discord channel
community.general.discord:
webhook_id: "00000"
webhook_token: "XXXYYY"
content: "This is a message from ansible"
- name: Send a message to the Discord channel with specific username and avatar
community.general.discord:
webhook_id: "00000"
webhook_token: "XXXYYY"
content: "This is a message from ansible"
username: Ansible
avatar_url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
- name: Send a embedded message to the Discord channel
community.general.discord:
webhook_id: "00000"
webhook_token: "XXXYYY"
embeds:
- title: "Embedded message"
description: "This is an embedded message"
footer:
text: "Author: Ansible"
image:
url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
- name: Send two embedded messages
community.general.discord:
webhook_id: "00000"
webhook_token: "XXXYYY"
embeds:
- title: "First message"
description: "This is my first embedded message"
footer:
text: "Author: Ansible"
image:
url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
- title: "Second message"
description: "This is my first second message"
footer:
text: "Author: Ansible"
icon_url: "https://docs.ansible.com/ansible/latest/_static/images/logo_invert.png"
fields:
- name: "Field 1"
value: "Value of my first field"
- name: "Field 2"
value: "Value of my second field"
timestamp: "{{ ansible_date_time.iso8601 }}"
Значения возврата
Общие значения возврата документированы здесь, следующие поля уникальны для этого модуля:
Ключ | Описание |
|---|---|
http_code целое число | Код ответа, возвращенный API Discord. Возвращается: всегда Пример: |
Ссылки на коллекцию
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/discord_module.html