Модуль community.general.discord — отправка сообщений в Discord
Примечание
Этот модуль входит в коллекцию community.general (версия 12.6.1).
Возможно, эта коллекция уже установлена, если вы используете пакет ansible. Она не входит в ansible-core. Чтобы проверить, установлена ли она, выполните ansible-galaxy collection list.
Чтобы установить её, используйте: ansible-galaxy collection install community.general.
Чтобы использовать её в плейбуке, укажите: community.general.discord.
Добавлено в community.general 3.1.0
Краткое описание
- Отправляет сообщение в канал Discord с помощью API вебхуков Discord.
Параметры
Параметр | Комментарии |
|---|---|
avatar_url string | Переопределяет аватар по умолчанию для вебхука. |
content string | |
embeds list / elements=dictionary | Отправляет сообщения в канал Discord в виде Embeds. В Embeds могут быть цветная рамка, встроенные изображения, текстовые поля и другие элементы. Допустимые параметры описаны в документации Discord: https://discord.com/developers/docs/resources/channel#embed-object. Необходимо указать как минимум один из параметров |
tts boolean | Установите значение Варианты:
|
username string | Переопределяет имя пользователя вебхука по умолчанию. |
webhook_id string / обязательный | Идентификатор вебхука. Формат URL вебхука Discord: |
webhook_token string / обязательный | Токен вебхука. Формат URL вебхука Discord: |
Атрибуты
Атрибут | Поддержка | Описание |
|---|---|---|
check_mode | Поддержка: полная | Может выполняться в режиме |
diff_mode | Поддержка: отсутствует | В режиме diff возвращает сведения об изменениях (или о том, что, возможно, требуется изменить в |
См. также
См. также
- Документация 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/favicon/favicon-32x32.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/favicon/favicon-32x32.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/favicon/favicon-32x32.png"
- title: "Second message"
description: "This is my first second message"
footer:
text: "Author: Ansible"
icon_url: "https://docs.ansible.com/favicon/favicon-32x32.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 integer | Код ответа, возвращённый API Discord. Возвращается: всегда Пример: |
Ссылки на коллекцию
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/general/discord_module.html