Zomis / Duga

Stack Exchange Chat bot
18 stars 6 forks source link

Message format refactoring #50

Closed Zomis closed 9 years ago

Zomis commented 9 years ago

In the current code, there's a whole lot of this:

chatBot.postMessage(MessageFormat.format("\\[[**{0}**]({1})\\] [**{2}**]({3}) assigned [**{4}**]({5}) to issue [**#{6}: {7}**]({8})",

With some refactoring, that could become something like: chatBot.postMessage(SomeFormat.format("%repository% %user% assigned %who% to issue %issue%",

The reason I propose this is because the \\[[**{0}**]({1})\\] format is used a lot, together with the parameters event.getRepository().getFullName() and event.getRepository().getHtmlUrl()

Zomis commented 9 years ago

Significantly improved in the Grails version