Class representing a joined channel.
Esempio n. 1
1
 /// <summary>
 /// Sends command to start a commercial of variable length.
 /// </summary>
 /// <param name="channel">JoinedChannel representation of the channel to send the ad to.</param>
 /// <param name="length">Enum representing the length of advertisement should be.</param>
 public static void StartCommercial(this TwitchClient client, JoinedChannel channel, Enums.CommercialLength length)
 {
     switch(length)
     {
         case Enums.CommercialLength.Seconds30:
             client.SendMessage(channel, ".commercial 30");
             break;
         case Enums.CommercialLength.Seconds60:
             client.SendMessage(channel, ".commercial 60");
             break;
         case Enums.CommercialLength.Seconds90:
             client.SendMessage(channel, ".commercial 90");
             break;
         case Enums.CommercialLength.Seconds120:
             client.SendMessage(channel, ".commercial 120");
             break;
         case Enums.CommercialLength.Seconds150:
             client.SendMessage(channel, ".commercial 150");
             break;
         case Enums.CommercialLength.Seconds180:
             client.SendMessage(channel, ".commercial 180");
             break;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Enables slow mode. messageCooldown must be less than 1 day.
        /// </summary>
        /// <param name="messageCooldown">TimeSpan object representing how long message cooldowns should be. May not exceed 1 day total.</param>
        /// <param name="channel">JoinedChannel representation of which channel to send the slow command to.</param>
        public static void SlowModeOn(this TwitchClient client, JoinedChannel channel, TimeSpan messageCooldown)
        {
            if (messageCooldown > TimeSpan.FromDays(1))
                throw new Exceptions.Client.InvalidParameterException("The message cooldown time supplied exceeded the maximum allowed by Twitch, which is 1 day.", client.TwitchUsername);

            client.SendMessage(channel, $".slow {messageCooldown.TotalSeconds}");
        }
Esempio n. 3
0
        /// <summary>
        /// Enables follower only chat, requires a TimeSpan object to indicate how long a viewer must have been following to chat. Maximum time is 90 days (3 months).
        /// </summary>
        /// <param name="channel">JoinedChannel object representing which channel to send command to.</param>
        /// <param name="requiredFollowTime">Amount of time required to pass before a viewer can chat. Maximum is 3 months (90 days).</param>
        public static void ChangeChatColor(this TwitchClient client, JoinedChannel channel, TimeSpan requiredFollowTime)
        {
            if (requiredFollowTime > TimeSpan.FromDays(maximumDurationAllowedDays))
                throw new Exceptions.Client.InvalidParameterException("The amount of time required to chat exceeded the maximum allowed by Twitch, which is 3 months.", client.TwitchUsername);

            string duration = $"{requiredFollowTime.Days}d {requiredFollowTime.Hours}h {requiredFollowTime.Minutes}m";

            client.SendMessage(channel, $".followers {duration}");
        }
Esempio n. 4
0
 /// <summary>
 /// Enables subscriber only mode in chat.
 /// </summary>
 /// <param name="channel">JoinedChannel representation of which channel to send subscriber only command to.</param>
 public static void SubscribersOnlyOn(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".subscribers");
 }
Esempio n. 5
0
 /// <summary>
 /// Disables slow mode.
 /// </summary>
 /// <param name="channel">JoinedChannel representation of which channel to send slowoff command to.</param>
 public static void SlowModeoff(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".slowoff");
 }
Esempio n. 6
0
 /// <summary>
 /// Sends command to unhost if a stream is being hosted.
 /// </summary>
 /// <param name="channel">JoinedChannel representation of the channel to send the unhost command to.</param>
 public static void Unhost(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".unhost");
 }
Esempio n. 7
0
 /// <summary>
 /// Sends command to host a given channel.
 /// </summary>
 /// <param name="userToHost">The channel to be hosted.</param>
 /// <param name="channel">JoinedChannel representation of which channel to send the host command to.</param>
 public static void Host(this TwitchClient client, JoinedChannel channel, string userToHost)
 {
     client.SendMessage(channel, $".host {userToHost}");
 }
Esempio n. 8
0
 /// <summary>
 /// Sends request to clear chat (may be ignored by plugins like BTTV)
 /// </summary>
 /// <param name="channel">JoinedChannel representation of which channel to send clear chat command to.</param>
 public static void ClearChat(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".clear");
 }
 /// <summary>
 /// Sends request to change color of chat name in Twitch chat.
 /// </summary>
 /// <param name="channel">JoinedChannel object representing which channel to send command to.</param>
 /// <param name="color">Enum representing available chat preset colors.</param>
 public static void ChangeChatColor(this TwitchClient client, JoinedChannel channel, Enums.ChatColorPresets color)
 {
     client.SendMessage(channel, $".color {color}");
 }
Esempio n. 10
0
 /// <summary>
 /// Enables emote only chat requirement.
 /// </summary>
 /// <param name="channel">JoinedChannel representation of the channel to send the enable emote only command to.</param>
 public static void EmoteOnlyOn(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".emoteonly");
 }
Esempio n. 11
0
 /// <summary>
 /// Sends a command to remove moderator status from a specific viewer
 /// </summary>
 /// <param name="channel">JoinedChannel representation of which channel to send the command to.</param>
 /// <param name="viewerToUnmod">Username of the viewer to remove moderator status from.</param>
 public static void Unmod(this TwitchClient client, JoinedChannel channel, string viewerToUnmod)
 {
     client.SendMessage(channel, $".unmod {viewerToUnmod}");
 }
Esempio n. 12
0
 /// <summary>
 /// TImesout a user in chat using a JoinedChannel object.
 /// </summary>
 /// <param name="channel">Channel object to send timeout to</param>
 /// <param name="viewer">Viewer name to timeout</param>
 /// <param name="duration">Duration of the timeout via TimeSpan object</param>
 /// <param name="message">Message to accompany the timeout and show the user.</param>
 /// <param name="dryRun">Indicates a dryrun (will not sened if true)</param>
 public static void TimeoutUser(this TwitchClient client, JoinedChannel channel, string viewer, TimeSpan duration, string message = "", bool dryRun = false)
 {
     client.SendMessage(channel, $".timeout {viewer} {duration.TotalSeconds} {message}", dryRun);
 }
Esempio n. 13
0
 /// <summary>
 /// Disables follower only chat.
 /// </summary>
 public static void FollowersOnlyOff(this TwitchClient client, JoinedChannel channel)
 {
     client.SendMessage(channel, ".followersoff");
 }
Esempio n. 14
0
 /// <summary>
 /// Unbans a user in chat using JoinedChannel
 /// </summary>
 /// <param name="channel">JoinedChannel object to send unban to</param>
 /// <param name="viewer">Viewer name to unban</param>
 /// <param name="dryRun">Indicates a dryrun (will not send if true)</param>
 public static void UnbanUser(this TwitchClient client, JoinedChannel channel, string viewer, bool dryRun = false)
 {
     client.SendMessage(channel, $".unban {viewer}", dryRun);
 }