Skip to content

Discord Webhook

zvyap edited this page May 11, 2023 · 4 revisions

Preview

image

A short tutorial, you need a basic to create Discord Webhook [Official Article]

  • Get the URL of the webhook

image

  • Go to file ./src/test/java/com/zvyap/dailycheckin/test/CheckInDailyTest.java, click Edit this file

image

  • Follow the change below

From

                CheckInAction.builder()
                        .token(HoyoToken.of(System.getenv("USER_1_ID"), System.getenv("USER_1_TOKEN")))
                        .game(GameType.GENSHIN_IMPACT)
                        .game(GameType.HONKAI_STAR_RAIL)
                        .build()

To

                CheckInAction.builder()
                        .token(HoyoToken.of(System.getenv("USER_1_ID"), System.getenv("USER_1_TOKEN")))
                        .webhook(WebhookInfo.builder()
                                .url(System.getenv("WEBHOOK_URL"))
                                .avatar("https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
                                .name("HoyoDaily")
                                .build())
                        .game(GameType.GENSHIN_IMPACT)
                        .game(GameType.HONKAI_STAR_RAIL)
                        .build()

Avatar -> Avatar for Discord webhook
Name -> Name for webhook
URL -> URL for webhook [only support Discord] Do not show your webhook URL here, other can abuse with this URL

For context: Just follow this but add code block below

                        .webhook(WebhookInfo.builder()
                                .url(System.getenv("WEBHOOK_URL"))
                                .avatar("https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png")
                                .name("HoyoDaily")
                                .build())

Add your secret (webhook URL)

FOLLOW THIS But use secret name WEBHOOK_URL

Also don't forgot to edit ./.github/workflows/gradle.yml