RITlug / teleirc

Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
https://docs.teleirc.com/
GNU General Public License v3.0
141 stars 45 forks source link

Separate repeating code blocks into their own function #337

Closed Tjzabel closed 4 years ago

Tjzabel commented 4 years ago

Summary

The handler.go Telegram file contains many repeating code blocks while checking for ZWSP. This should get moved into its own helper function in helpers.go.

Details

Example code block is as follows:

username := ""
    if tg.IRCSettings.ShowZWSP {
        username = ZwspUsername(u.Message.From)
    } else {
        username = GetUsername(u.Message.From)
    }

Outcome

The above code block is moved into its own separate function to reduce repeating code.

nanikjava commented 4 years ago

Happy to take this on. Thanks.

Amirhossein2000 commented 4 years ago

Hi Please review my pull request and fell free about any opinion.

jwflory commented 4 years ago

Thanks @Amirhossein2000, another core developer will finish reviewing PR #338.

@nanikjava, there are a few other "Hacktoberfest" good first issues to work on. Try taking a look at one of those and let us know if any of them look interesting to you! :slightly_smiling_face:

Tjzabel commented 4 years ago

Fixed via #338