Skip to content
sunrise

GitHub Action

Discord - Color of the Day

1.0.3 Latest version

Discord - Color of the Day

sunrise

Discord - Color of the Day

Set the color of the day for a role in a Discord server

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Discord - Color of the Day

uses: TinkerStorm/[email protected]

Learn more about this action in TinkerStorm/discord-cotd-action

Choose a version

discord-cotd-action

An action to randomize the color of a role in Discord each time it is called upon.

Usage

- name: Randomize color of role
  uses: TinkerStorm/discord-cotd-action@main
  with:
    app-token: ${{ secrets.DISCORD_TOKEN }}
    guild-id: "123456789012345678"
    role-id: "123456789012345678"
    # role-format: "COTD - &s"

Inputs (with.*)

All arguments are required unless otherwise specified.

Warning
The application (app-token) must have...

  • membership for the specified guild (guild-id)
  • MANAGE_ROLES permission
  • a role higher than the specified (role-id)

app-token

The Discord application token. This can be found in the Discord developer portal (discord.com).

Warning
The token should be stored as a secret (docs.github.com) in your repository. Posting it publicly is a security risk, and Discord will reset it (docs.github.com) if committed to a public repository.

guild-id

The ID of the guild to change the role color in.

role-id

The ID of the role to randomize the color of. This can be found by right-clicking the role in Discord and selecting "Copy ID".

role-format

This input is optional.

The format of the role name. The following variables are available:

  • &s - The color name
  • &h - The color hex code

Outputs

color-int

The integer representation of the color that was set.

color-hex

The hexadecimal representation of the color that was set.

License

This project is licensed under the MIT License.

Future

  • Implement a test suite for the action itself, and the functions that it uses.

    It was originally removed due to the complexity of requiring a request mock, and the lack of documentation on how to do so. I may be able to implement it in the future, but for now, it is not a priority.

  • Implement a way to set a color according to a provided argument (-> with.color-wheel: #7289DA,...).

    Default to first element, if current color is not in provided list.

  • Implement a way to adjust for web safe colors (-> with.use-web-safe-colors: boolean).