I’m currently attempting to build upon an already existing plugin called ‘discourse-chat-integration’ for which I’ve forked and attempted to customize for a certain community but I’m having a wee mind blank. How would I specifically test if it’s a post or thread? I’m trying to build two seperate notification blocks, one for a post and another for a thread.
I have attempted to find it already with ‘post_number’ but it doesn’t seem to work. Any ideas? Thank you.
Thank you for your reply and response my topic. Would this be the correct method in completing the task? The first block should only send if it’s a thread and the second block should only send if it’s a post.
Yes, that looks roughly correct. I think you will need to change the two
message
lines to
return message
so that it stops execution of the function at that point.
What are you trying to achieve here? It might be possible to do something using the existing configuration options, rather than maintaining a fork of the plugin.
Thank you for your reply, I will change the stated lines and test now. Currently the plugin will send a Webhook to Discord on any new topics or posts. I am quite new to Ruby so I apologize for the lack of knowledge with this situation.
I came across that option previously but I want a totally seperate notification layout for each. I’ve changes the lines you stated previously but it’s throwing an error at me now which suggests that no message is being returned from the previous screenshot.
Thank you for responding. I did link the file I am referring to in my thread description. These are the errors I am receiving, I would assume that I need to include some kind of file. Any thoughts?
I apologise for bumping this thread but integrating with this code, how would I be able to retrieve a user’s custom field value? Would this even be possible at all?
Yes, if that’s possible. I’ve created a custom field named ‘Embed Colour’ and added it into the code but it appears to be blank when it’s retrieved. Any suggestions?