Smuzzy-waiii / bunsamosa-bot

BunSamosa Bot is the official bot for ACM PESUECC's Hacknight 2023
1 stars 2 forks source link

whitespace and other formatting bugs in !bounty #5

Open Smuzzy-waiii opened 1 year ago

Smuzzy-waiii commented 1 year ago

Currently this the code for interpreting !bounty assignments

// parse the comment here to give a bounty
comment_text_parts := strings.Split(parsed_hook.Comment.Body, " ")
if comment_text_parts[0] == "!bounty" {
    // Convert the points
    points, err := strconv.Atoi(comment_text_parts[1])
...

This is obviously prone to problems if the maintainer were to accidentally place a whitespace before !bounty in their comments and other such formatting bugs. Fix all formatting bugs that might happen accounting for common maintainer comments formats (like newline after bounty points number etc)

To refresh this is bounty assign comment format: !bounty

Eg: !bounty 30

This is a comment that needs to be made on a PR (and not a issue) which assigns to the user who created the PR

Smuzzy-waiii commented 1 year ago

Might need to sanitise input so that the bounty points are within a sane range