Skip to content

trivigy/discord-resource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord notification resource

Sends messages to Discord channels.

Please note that I do not have automated deployment to docker hub yet and will set it up in the future. For now I do it regularly when I update the repo.

Resource Type Configuration

resource_types:
- name: discord-resource
  type: docker-image
  source:
    repository: trivigy/discord-resource

Resource Configuration Example

resources:
- name: discord
  type: discord-resource
  check_every: 999999h
  source:
    token: ((token))

Behavior

check: Not implemented.

in: Not implemented.

out: Send message to a Discord channel.

Send message to a discord channel with the configured parameters. Parameters can be passed in using the params key on the put step or passed in via files.

Parameters: params

One of either the _file or non-_file parameters are required.

The _file parameters take precedence over whatever is set in the params key of the put step.

  • channel (string): Specifies which channel to post the message in. The bot must have permissions authorized to send_messages for the specific channel. The channel ID is a number that should be provided in quotes.
  • channel_file (string): Specifies which channel to post the message in. The bot must have permissions authorized to send_messages for the specific channel. The channel ID is a number. It does not need to be wrapped in quotes within the text file.
  • title (string): Any text wanted to ultimately appear on the page as the title of the message.
  • title_file (string): Path to file containing the text wanted to ultimately appear on the page as the title of the message.
  • message (string): The text that will be inside the body of the message.
  • message_file (string): Path to file containing the text that will be inside the body of the message.
  • color (string): A hex color code. This will be the background color of the message when posted to Discord. Defaults to black if omitted.

Usage Examples

jobs:
- name: discord-send
  plan:
  - put: discord
    params:
      channel: "((channel_id))"
      color: "5CB85C"
      title: Hello World!
      message: |
        Success

Using the _file params. There's a task step before the put which generates the discord-message output.

jobs:
- name: discord-send
  plan:
  - task: generate-discord-message
    file: tasks/generate-discord-message.sh
  - put: discord
    params:
      channel_file: "discord-message/channel"
      title_file: "discord-message/title"
      message_file: "discord-message/message"

Useful resources

Creating a discord bot and getting a token