Esempio n. 1
0
        private void OnPush(PushEvent.RootObject obj)
        {
            //https://developer.github.com/v3/activity/events/types/#pushevent
            if (obj == null)
            {
                return;
            }

            SendEventMessage(DiscordMessageFormatter.GetOnPushMessage(obj));
        }
Esempio n. 2
0
        public static EmbedBuilder GetOnPushMessage(PushEvent.RootObject obj)
        {
            var builder = new EmbedBuilder()
            {
                Color       = Const.DISCORD_EMBED_COLOR,
                Description = $"{obj.sender.login} pushed {obj.commits.Count} commit(s) to {obj.repository.full_name}"
            };

            foreach (var commit in obj.commits)
            {
                builder.AddField(x =>
                {
                    x.Name     = commit.message;
                    x.Value    = $"{commit.url}\nAdded: {commit.added.Count}\nRemoved: {commit.removed.Count}\nModified: {commit.modified.Count}";
                    x.IsInline = false;
                });
            }

            return(builder);
        }