TinkerStorm / discord-cotd-action

Color of the Day (COTD) on Discord using GitHub Actions

Home Page:https://discord.gg/z5DPVHNBuw

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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).

About

Color of the Day (COTD) on Discord using GitHub Actions

https://discord.gg/z5DPVHNBuw

License:MIT License


Languages

Language:TypeScript 98.0%Language:JavaScript 2.0%