Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for single or multiple discord webhook urls per feed #1

Merged
merged 5 commits into from
May 30, 2024

Conversation

nayyara-airlangga
Copy link
Contributor

@nayyara-airlangga nayyara-airlangga commented May 29, 2024

Background

I want to host Brassite to provide a few newsfeeds to several discord servers. The current config limitation means that to push the same newsfeed to multiple channels, I would need to create several feeds in the configuration with the only difference probably being the discord webhook url.

Feature Request and Changes

I've changed the configuration struct to support arrays of strings for the webhook urls. To maintain compatibility with the previous string-only field, I've decided to implement a few simple unmarshal functions for each supported file format.

Outcome

We can now support formats such as this

feeds:
  - name: Lorem Ipsum
    url: http://lorem-rss.herokuapp.com/feed?unit=second&interval=30&length=3
    logo: https://www.clipartmax.com/png/middle/75-756149_big-image-generic-logo-png-transparent.png
    interval: 30s
    without_content: false
    delivery:
      discord_webhook_url:
        - https://discord.com/api/webhooks/1245420624420274249/Q7rxVwbmV6X_y-AypuevwjVPlRcjxrGvXxnB9da4dy1TNnqiCaXyUZ-AFBBiOnqeNFQ4
        - https://discord.com/api/webhooks/1245420809095352400/IU3Pg2kvAoHJ6a6LN6NFP3uqKUnWiRDh5aDVO_eQu2LYdO3y0KgILhTOgmUlwpRSSMy5

as well as this

feeds:
  - name: Lorem Ipsum
    url: http://lorem-rss.herokuapp.com/feed?unit=second&interval=30&length=3
    logo: https://www.clipartmax.com/png/middle/75-756149_big-image-generic-logo-png-transparent.png
    interval: 30s
    without_content: false
    delivery:
      discord_webhook_url: https://discord.com/api/webhooks/1245420624420274249/Q7rxVwbmV6X_y-AypuevwjVPlRcjxrGvXxnB9da4dy1TNnqiCaXyUZ-AFBBiOnqeNFQ4

@nayyara-airlangga nayyara-airlangga changed the title feat: add support for single or multiple discord webhook urls feat: add support for single or multiple discord webhook urls per feed May 29, 2024
Copy link
Member

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, but just a little bit more.

cmd/brassite/main.go Outdated Show resolved Hide resolved
@aldy505
Copy link
Member

aldy505 commented May 30, 2024

@nayyara-airlangga there's a merge conflict, can you fix that up real quick?

@nayyara-airlangga
Copy link
Contributor Author

@nayyara-airlangga there's a merge conflict, can you fix that up real quick?

Resolved ✅

@aldy505 aldy505 merged commit 0506f19 into teknologi-umum:master May 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants