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

Discord doesn't notify me when a message with mention has arrived. #10

Closed
everalan10 opened this issue Aug 20, 2019 · 8 comments
Closed

Comments

@everalan10
Copy link

Hi, thanks for this plugin is awesome.

We are a team with 10 people into a Discord Server, but we dont want to advice to all when a fail or succeed has been occurred. We mute the channel and only the interested people must read it.

The problem is every time that we receive a message from Jenkins, the mentions are not accumulated into the Discord mentions area. appears empty.

mentions

But the message appears ok with the name of the user.
Discord mention

Again, Thanks.

@KocproZ
Copy link

KocproZ commented Aug 21, 2019

Unfortunately mentioning people inside the embed doesn't send a notification (discord doesn't allow that).
In the settings for this plugin there is a text field called Notes. Putting mentions there works, but it will be displayed outside the embed.

@everalan10
Copy link
Author

Oh it's ok no problem. do you know how to pass that "notes" parameter into a pipeline style command?

@melt7777
Copy link

Here is a example of what I am using in my Jenkinsfile (Using Scripted Pipeline, may differ for Declarative Pipeline)

// URL of Discord webhook for posting build notifications
      def discordURL = 'https://discordapp.com/api/webhooks/Shortkey/Longkey'
      // URL of image png/jpg to place to right of Discord build notifications
      def discordImage = 'https://blabla.png'
      
      def discordDesc = "description\n"
      def discordFooter = "footer desc with vars: ${env.JOB_BASE_NAME}` (build #${BUILD_NUMBER})"
      def discordTitle = "${buildName} (devel)"
      discordSend description: discordDesc, 
                  footer: discordFooter, 
                  link: env.JOB_URL, 
                  result: currentBuild.currentResult, 
                  title: discordTitle, 
                  webhookURL: discordURL, 
                  successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), 
                  thumbnail: discordImage
   }

Hope this helps - and great work you all! Thanks so much :)

~ melt
getpimp.org | miner.farm

@KocproZ
Copy link

KocproZ commented Aug 24, 2019

@everalan10 I just pushed an update to the plugin, from now on you can pass notes parameter into the pipeline (notes: "text"). Let me know if this works for you.

@melt7777
Copy link

Hi KocproZ, Thanks for adding a feature.

I have added the notes: "note output here" parameter to the above code, and when the plugin update is available in Jenkins Plugin Manager I will try it with @ mentions as well and post my results here.

~ melt
getpimp.org | miner.farm

@melt7777
Copy link

Test results for Declarative Pipeline code using "notes" parameter with mentions. The test failed, and the mentions were not picked up by discord.

Discord-notifier version: 1.4.10

      discordSend description: discordDesc, 
                  footer: discordFooter, 
                  link: env.JOB_URL, 
                  result: currentBuild.currentResult, 
                  title: discordTitle, 
                  webhookURL: discordURL, 
                  successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'),
                  thumbnail: discordImage,
                  notes: "Here's some Notes! @melt @melt#2019 @melt (getpimp.org)#2019 @Support"
   }

Resulting output in Discord:

image

Hope this helps, let me know if you would like any other testing performed. Your work on this project is always appreciated!

~ melt
getpimp.org | miner.farm

@KocproZ
Copy link

KocproZ commented Sep 16, 2019

To get mentions to work from webhook you have to mention someone by their id.
For example when I put this in notes: Hey <@151765009876123648>, the build is done!, I get this:
image

@melt7777
Copy link

Aha, thank you, the <@id> syntax worked great:
image

Thanks again!

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

No branches or pull requests

3 participants