prjseal / SlackBotMessages

A .NET library to enable you to send bot messages in slack
MIT License
55 stars 19 forks source link

IconEmoji not working #16

Closed ericbrunner closed 4 years ago

ericbrunner commented 4 years ago

Hi Paul,

I use your sample and it works , dispite the IconEmoji. Am I doing something wrong? Here my code:

                var client = new SbmClient(webHookUrl);

                var message = new Message
                {
                    Username = "CodemeterWatchDog",
                    Text = "Codemeter LicenseServer has 0 licenses left",
                    IconEmoji = Emoji.ArrowRight
                };

                await client.SendAsync(message);

I get that:

image

prjseal commented 4 years ago

Hi Eric Have you got these usings at the top of your file:

using SlackBotMessages;
using SlackBotMessages.Enums;
using SlackBotMessages.Models;
ericbrunner commented 4 years ago

Hi Paul Thanks for your effort. Yes I added it. Still same result.

Here the full sample code:

using System;
using System.Threading.Tasks;

using SlackBotMessages;
using SlackBotMessages.Enums;
using SlackBotMessages.Models;

namespace CodemeterWatchdog
{
    class Program
    {
        static string webHookUrl = "my-url";

        static async Task Main(string[] args)
        {
            #region Post a Slack Bot Message

            try
            {
                var client = new SbmClient(webHookUrl);

                var message = new Message
                {
                    Username = "CodemeterWatchDog",
                    Text = "Codemeter LicenseServer has 0 licenses left",
                    IconEmoji = Emoji.ArrowRight
                };

                await client.SendAsync(message);
                Console.WriteLine($"message sent: {message.Username}:{message.Text}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

            }

            #endregion

            Console.ReadKey();
        }
    }
}

Best, Eric

prjseal commented 4 years ago

I can get it working here https://dotnetfiddle.net/gLQVC4#

ericbrunner commented 4 years ago

You posted mycode to public domain. Please delete that dotnetfiddle. Further it doesn't work

prjseal commented 4 years ago

You posted your code here first which is public. I just put it in a private dotnetfiddle and shared the link here where you’d already shared the code. I’m sorry, I was just trying to help you.