JohnnyJayJay / instant-poll

A Discord bot that lets you create polls in your server
MIT License
42 stars 9 forks source link

Issues with giving Webhook permissions to create poll. #17

Closed shotah closed 2 years ago

shotah commented 2 years ago

Unsure of how to enable a webhook to create a poll.

Looking at creating a poll for any issues that have the enhancement label. I need to spend some more time with the event api to see how to pull out the labels and subjects, but currently its not able to create a poll. I just see the plain text pop out into discord.

Thanks!

on:
  issues:
    types: [labeled]

env:
  DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

jobs:
  poll:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - name: poll
        # if: contains(github.event.label, 'enhancement')
        uses: Ilshidur/action-discord@master
        with:
          args: "/poll create question: ${{ github.event }} 1: Interested 2: Uninterested 3: Not needed"
JohnnyJayJay commented 2 years ago

I'm not sure I get what's happening here exactly.\ You have a GitHub actions workflow that sends a Discord Webhook every time someone opens an enhancement issue on your repository. Did I get that right?

In that case, I'm afraid this is not possible. Only users can run slash commands. Slash commands are not messages that start with a /, that is merely a UI thing.

To realise something like this, you'll need to write an own bot that proactively sends a poll to your channel when an issue is created (you could trigger it via an action or perhaps use some other GitHub API). I.e., you need to tailor something to fit your specific needs.\ I can say 2 things right away:

Hope I could help/give you some ideas. Unfortunately instant-poll itself will not really be helpful for your purpose.

shotah commented 2 years ago

Thanks! yep, that is what I've started to look at. Cheers!