Esempio n. 1
0
        void IInitializableModule.Initialize()
        {
            StreamModule streammodule = context.GetModule <StreamModule>();

            notificationwindow = context.GetModule <NotificationModule>();
            usermodule         = context.GetModule <UserModule>();
            imagemodule        = context.GetModule <ImageCacheModule>();

            streammodule.NewFollower += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Follower").BuildMessage(),
                new MessageBuilder()
                .User(usermodule.GetExistingUser(information.Service, information.Username), u => imagemodule.AddImage(u.Avatar))
                .Text(" started to follow.")
                .BuildMessage()
                );

            streammodule.NewSubscriber += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Subscriber").BuildMessage(),
                new MessageBuilder()
                .User(usermodule.GetExistingUser(information.Service, information.Username), u => imagemodule.AddImage(u.Avatar))
                .Text(" subscribed with ")
                .Text(information.PlanName, StreamColors.Option, FontWeight.Bold)
                .Text(" to this channel.")
                .BuildMessage()
                );

            streammodule.Hosted += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Host").BuildMessage(),
                information.Viewers > 0 ?
                new MessageBuilder().User(usermodule.GetExistingUser(information.Service, information.Channel), u => imagemodule.AddImage(u.Avatar)).Text(" is hosting this channel to ").Text(information.Viewers.ToString(), StreamColors.Option, FontWeight.Bold).Text(" viewers.").BuildMessage() :
                new MessageBuilder().User(usermodule.GetExistingUser(information.Service, information.Channel), u => imagemodule.AddImage(u.Avatar)).Text(" is hosting this channel.").BuildMessage()
                );

            streammodule.Raid += OnRaid;
        }
Esempio n. 2
0
 /// <summary>
 /// creates a new <see cref="TwitchUserChat"/>
 /// </summary>
 /// <param name="channel">channel access</param>
 /// <param name="usermodule">access to usermodule</param>
 /// <param name="imagecache">access to image cache</param>
 public TwitchUserChat(ChatChannel channel, UserModule usermodule, ImageCacheModule imagecache)
 {
     this.channel             = channel;
     this.usermodule          = usermodule;
     this.imagecache          = imagecache;
     channel.UserJoined      += OnUserJoined;
     channel.UserLeft        += OnUserLeft;
     channel.MessageReceived += OnMessageReceived;
     channel.Subscription    += s => Subscription?.Invoke(s);
 }
 void IRunnableModule.Start()
 {
     usermodule        = context.GetModule <UserModule>();
     imagemodule       = context.GetModule <ImageCacheModule>();
     streameventmodule = context.GetModule <StreamEventModule>();
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/events", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/events.css", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/events.js", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/events/data", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/highlight", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/highlight.css", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/highlight.js", this);
     context.GetModule <HttpServiceModule>().AddServiceHandler("/streamrc/highlight/data", this);
 }
Esempio n. 4
0
 /// <summary>
 /// creates a new <see cref="TwitchAccountChat"/>
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="usermodule"></param>
 /// <param name="imagecache"></param>
 public TwitchAccountChat(ChatChannel channel, UserModule usermodule, ImageCacheModule imagecache)
     : base(channel, usermodule, imagecache)
 {
     channel.Raid += notice => Raid?.Invoke(this, new RaidInformation()
     {
         Service       = TwitchConstants.ServiceKey,
         Login         = notice.Login,
         DisplayName   = notice.DisplayName,
         Color         = notice.Color,
         Avatar        = notice.Avatar,
         Channel       = notice.Channel,
         RaiderCount   = notice.RaiderCount,
         RoomID        = notice.RoomID,
         SystemMessage = notice.SystemMessage
     });
 }
Esempio n. 5
0
 /// <summary>
 /// creates a new <see cref="TwitchBotChat"/>
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="usermodule"></param>
 /// <param name="imagecache"></param>
 public TwitchBotChat(ChatChannel channel, UserModule usermodule, ImageCacheModule imagecache)
     : base(channel, usermodule, imagecache)
 {
 }