Example #1
0
        public SlackWebhookResponse FromOmdbTitleAsAttachment(OmdbTitle omdbTitle, string webhookUsername = "******")
        {
            var imdbTitle = FormatImdbTitle(omdbTitle.Title, omdbTitle.imdbId, omdbTitle.Year);
            var imdbText  = FormatImdbText(omdbTitle.Plot, omdbTitle.imdbRating, omdbTitle.Poster, omdbTitle.Director);

            var response = new SlackWebhookResponse();

            var attachment = new SlackWebhookResponseAttachment()
            {
                fallback = imdbTitle,
                pretext  = imdbTitle,
                color    = "#FACC2E"
            };

            var fields = new SlackWebhookResponseAttachmentFields()
            {
                title = omdbTitle.Title,
                value = imdbText
            };

            attachment.fields.Add(fields);
            payload.attachments.Add(attachment);
            response.payload          = payload;
            response.payload.username = webhookUsername;
            response.payload.text     = "<" + FormatImdbPoster(omdbTitle.imdbId) + ">";

            return(response);
        }
Example #2
0
        public string FromOmdbTitle(OmdbTitle omdbTitle)
        {
            var imdbLink = string.Format("http://www.imdb.com/title/{0}", omdbTitle.imdbId);

            return(string.Format(
                       @"*{0}* ({1}) - rating {2} 
        {3}
        {4}", omdbTitle.Title, omdbTitle.Year, omdbTitle.imdbRating, omdbTitle.Plot, imdbLink));
        }
Example #3
0
        public SlackWebhookResponse FromOmdbTitle(OmdbTitle omdbTitle, string webhookUsername = "******")
        {
            var imdbTitle = FormatImdbTitle(omdbTitle.Title, omdbTitle.imdbId, omdbTitle.Year);
            var imdbText  = FormatImdbText(omdbTitle.Plot, omdbTitle.imdbRating, omdbTitle.Poster, omdbTitle.Director);
            var posterUrl = FormatImdbPoster(omdbTitle.imdbId);

            var response = new SlackWebhookResponse();

            response.payload.username = webhookUsername;
            response.payload.text     = string.Format("{0}\n{1}\n{2}", imdbTitle, imdbText, posterUrl);

            return(response);
        }