Code Monkey home page Code Monkey logo

discordwebhooksender's Introduction

DiscordWebhookSender

Version: 1.0.0

DiscordWebhookSender is a project designed to send messages to a Discord webhook using Python and Docker.

Table of Contents

Description

DiscordWebhookSender is a simple tool to send messages to a specified Discord webhook URL. It is containerized using Docker to ensure ease of deployment and use.

How to Use

Build the Docker Image

To build the Docker image, run the following command:

make docker-build

Run the Docker Container

To run the Docker container, use one of the following commands, replacing <YOUR_WEBHOOK_URL>, <YOUR_MESSAGE>, <YOUR_EMBED_TITLE>, <YOUR_EMBED_DESCRIPTION>, and <YOUR_EMBED_COLOR> with your actual values:

For a simple message:

docker run --rm -e DISCORD_WEBHOOK_URL="<YOUR_WEBHOOK_URL>" -e DISCORD_MESSAGE="<YOUR_MESSAGE>" discord-webhook-sender

For a message with embed:

docker run --rm \
  -e DISCORD_WEBHOOK_URL="<YOUR_WEBHOOK_URL>" \
  -e DISCORD_MESSAGE="<YOUR_MESSAGE>" \
  -e DISCORD_EMBED_TITLE="<YOUR_EMBED_TITLE>" \
  -e DISCORD_EMBED_DESCRIPTION="<YOUR_EMBED_DESCRIPTION>" \
  -e DISCORD_EMBED_COLOR="<YOUR_EMBED_COLOR>" \
  discord-webhook-sender

Environment Variables

  • DISCORD_WEBHOOK_URL: The URL of the Discord webhook.
  • DISCORD_MESSAGE: The message to be sent.
  • DISCORD_EMBED_TITLE: The title of the embed (optional).
  • DISCORD_EMBED_DESCRIPTION: The description of the embed (optional).
  • DISCORD_EMBED_COLOR: The color of the embed in hexadecimal format without # (optional).

Development

Installation

To set up the development environment, you need to have Poetry installed. Then, run:

poetry install

Commands

  • Run tests:

    To run the test suite, use:

    poetry run make test
  • Lint and format code:

    To lint and format the code, use:

    make lint
  • Build Docker image:

    To build the Docker image, use:

    make docker-build
  • Run Docker container:

    To run the Docker container, use:

    make docker-run
  • Clean the project:

    To clean the project, use:

    make clean

Contribution

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Pipeline Example

Here is an example of how to use DiscordWebhookSender in a pipeline:

notify:
  stage: post-apply
  image: 
    name: caiolombello/discord-webhook-sender
  variables:
    DISCORD_WEBHOOK_URL: <YOUR_WEBHOOK_URL>
    DISCORD_MESSAGE: "Infrastructure deployment completed successfully."
    DISCORD_EMBED_TITLE: "Deployment Notification"
    DISCORD_EMBED_DESCRIPTION: "Your deployment was successful."
    DISCORD_EMBED_COLOR: "00FF00"
  script: /app/send_webhook
  dependencies:
    - apply

This example demonstrates how to use the DiscordWebhookSender image in a CI/CD pipeline to send a notification after successful infrastructure deployment.

discordwebhooksender's People

Contributors

caiolombello avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.