package com.bwfcwalshy.flarebot.github;

import com.arsenarsen.githubwebhooks4j.events.EventListener;
import com.arsenarsen.githubwebhooks4j.events.PushEvent;
import com.arsenarsen.githubwebhooks4j.objects.Commit;
import com.bwfcwalshy.flarebot.FlareBot;
import com.bwfcwalshy.flarebot.MessageUtils;
import sx.blah.discord.handle.obj.IChannel;

public class GithubListener implements EventListener<PushEvent> {

    private IChannel githubChannel;

    @Override
    public void handle(PushEvent e) {
        StringBuilder sb = new StringBuilder();
        sb.append("New push by **")
                .append(e.getPusher().getName())
                .append("** in branch ")
                .append("`")
                .append(e.getRef().substring(e.getRef().lastIndexOf('/') + 1))
                .append("`\n");
        for(Commit commit : e.getCommits()){
            sb.append("`")
                    .append(commit.getId()).append("` ")
                    .append(commit.getMessage());
        }
        MessageUtils.sendMessage(FlareBot.getInstance().getClient().getChannelByID("229236239201468417"), sb.toString());
    }
}

@@ -569,12 +569,14 @@
 New 
-push
+commit
  by 
@@ -870,32 +870,54 @@
      sb.append(%22
+:arrow_up: %22).append(%22
 %60%22)%0A            
@@ -957,17 +957,49 @@
 ppend(%22%60
- 
+%22).append(%22 :pencil: %22).append(%22%60
 %22)%0A     
@@ -1041,16 +1041,28 @@
 ssage())
+.append(%22%60%22)
 ;%0A      

Update commit message.