Ejemplo n.º 1
0
        public MessageHeightTwitch(string Channel, string ChannelId, int TimeoutMs, bool Enable7TVEmotes)
        {
            var cts = new CancellationTokenSource(TimeoutMs);

            FFZEmoteProvider = new FFZEmoteProvider();
            try {
                FFZEmoteProvider.Initialize(Channel, cts.Token).GetAwaiter().GetResult();
                this.FFZGetEmote = FFZEmoteProvider.TryGetEmote;
            } catch (Exception ex) {
                Console.WriteLine("Failed to initialize FFZ: " + ex.ToString());
            }
            BTTVEmoteProvider = new BTTVEmoteProvider();
            try {
                BTTVEmoteProvider.Initialize(ChannelId, cts.Token).GetAwaiter().GetResult();
                this.BTTVGetEmote = BTTVEmoteProvider.TryGetEmote;
            } catch (Exception ex) {
                Console.WriteLine("Failed to initialize BTTV: " + ex.ToString());
            }
            if (Enable7TVEmotes)
            {
                SevenTVEmoteProvider = new SevenTVEmoteProvider();
                try {
                    SevenTVEmoteProvider.Initialize(ChannelId, cts.Token).GetAwaiter().GetResult();
                    SevenTVGetEmote = SevenTVEmoteProvider.TryGetEmote;
                } catch (Exception ex) {
                    Console.WriteLine("Failed to initialize 7TV: " + ex.ToString());
                }
            }
            TwitchEmotes              = new TwitchEmotes();
            this.TwitchGetEmote       = TwitchEmotes.GetEmote;
            this.BTTVIsEmojiSupported = (e) => BTTVEmoteProvider.IsEmojiSupported(e);
            this.FFZIsEmojiSupported  = (e) => FFZEmoteProvider.IsEmojiSupported(e);
        }
 public MessageHeightTwitch(string Channel)
 {
     FFZEmoteProvider = new FFZEmoteProvider();
     FFZEmoteProvider.Initialize(Channel).Wait();
     BTTVEmoteProvider = new BTTVEmoteProvider();
     BTTVEmoteProvider.Initialize(Channel).Wait();
     TwitchEmotes              = new TwitchEmotes();
     this.BTTVGetEmote         = BTTVEmoteProvider.TryGetEmote;
     this.FFZGetEmote          = FFZEmoteProvider.TryGetEmote;
     this.TwitchGetEmote       = TwitchEmotes.GetEmote;
     this.BTTVIsEmojiSupported = (e) => BTTVEmoteProvider.IsEmojiSupported(e);
     this.FFZIsEmojiSupported  = (e) => FFZEmoteProvider.IsEmojiSupported(e);
 }
        public MessageHeightTwitch(string Channel, string ChannelId, int TimeoutMs)
        {
            var cts = new CancellationTokenSource(TimeoutMs);

            FFZEmoteProvider = new FFZEmoteProvider();
            FFZEmoteProvider.Initialize(Channel, cts.Token).GetAwaiter().GetResult();
            BTTVEmoteProvider = new BTTVEmoteProvider();
            BTTVEmoteProvider.Initialize(ChannelId, cts.Token).GetAwaiter().GetResult();
            TwitchEmotes              = new TwitchEmotes();
            this.BTTVGetEmote         = BTTVEmoteProvider.TryGetEmote;
            this.FFZGetEmote          = FFZEmoteProvider.TryGetEmote;
            this.TwitchGetEmote       = TwitchEmotes.GetEmote;
            this.BTTVIsEmojiSupported = (e) => BTTVEmoteProvider.IsEmojiSupported(e);
            this.FFZIsEmojiSupported  = (e) => FFZEmoteProvider.IsEmojiSupported(e);
        }