public CommandDan(ICarl commandCallback, IFirehose firehose) : base(firehose) { m_client.DefaultRequestHeaders.Add("Client-ID", "Karl"); m_commandCallback = commandCallback; m_firehose.SubChatMessages(this); }
public FriendlyDan(IFirehose firehose) : base(firehose) { Setup(); m_firehose.SubUserActivity(this); m_firehose.SubCommandListener(this); s_instance = this; }
static public async Task <int> GlobalWhisper(IFirehose firehose, string userName, string message) { int?userId = await MixerUtils.GetUserId(userName); if (!userId.HasValue) { return(0); } return(await GlobalWhisper(firehose, userId.Value, userName, message)); }
static public async Task <int> GlobalWhisper(IFirehose firehose, int userId, string message) { string userName = await MixerUtils.GetUserName(userId); if (String.IsNullOrWhiteSpace(userName)) { return(0); } return(await GlobalWhisper(firehose, userId, userName, message)); }
public MessagesDan(IFirehose firehose) : base(firehose) { m_firehose.SubChatMessages(this); m_firehose.SubCommandListener(this); m_wordHistory.SetPreparer(this); m_statsThread = new Thread(StatsThread); m_statsThread.IsBackground = true; m_statsThread.Start(); }
public static async Task <bool> CheckForMutualFriendsAndMessageIfNot(IFirehose m_firehose, ChatMessage msg, int actionReceiverId, string action) { if (HasAdvancePermissions(msg.UserId) || FriendlyDan.AreMutualFriends(msg.UserId, actionReceiverId)) { return(true); } else { await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"You need to be mutual friends with {await MixerUtils.GetUserName(actionReceiverId)} before you can {action} them. You both need to friend each other with the \"^friends add\" command.", msg.IsWhisper); return(false); } }
static public async Task <bool> SendResponse(IFirehose firehose, int channelId, string userName, string message, bool whisper) { Logger.Info($"Sent {(whisper ? "whisper" : "message")} to {userName}: {message}"); bool success = false; if (whisper) { success = await firehose.SendWhisper(channelId, userName, message); } else { success = await firehose.SendMessage(channelId, message); } if (!success) { Logger.Error($"Failed to send message '{message}' to {userName} in channel {channelId}"); } return(success); }
static public async Task <int> GlobalWhisper(IFirehose firehose, int userId, string userName, string message) { List <int> channelIds = CreeperCarl.GetActiveChannelIds(userId); if (channelIds == null) { return(0); } else { // Whisper them the message in all of the channels. int successCount = 0; foreach (int channelId in channelIds) { if (await firehose.SendWhisper(channelId, userName, message)) { successCount++; } } return(successCount); } }
static public async Task <bool> SendResponse(IFirehose firehose, ChatMessage msg, string message, bool forceWhisper = true) { return(await SendResponse(firehose, msg.ChannelId, msg.UserName, message, msg.IsWhisper || forceWhisper)); }
public static async Task <bool> SendMixerUserNotFound(IFirehose m_firehose, ChatMessage msg, string failedToFindUserName, bool isChannel = false) { return(await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"I can't find a {(isChannel ? "channel" : "user")} named {await MixerUtils.GetProperUserName(failedToFindUserName)} on Mixer. Is that spelled correctly? 😕", msg.IsWhisper)); }
public static async Task <bool> SendCantFindUser(IFirehose m_firehose, ChatMessage msg, string failedToFindUserName) { return(await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"It doesn't look like {await MixerUtils.GetProperUserName(failedToFindUserName)} is active on Mixer right now. Maybe they're lurking? 🙈", msg.IsWhisper)); }
static public async Task <bool> SendAccessDenied(IFirehose firehose, int channelId, string userName) { return(await SendResponse(firehose, channelId, userName, "You don't have permissions to do that 🤨", true)); }
static public async Task <bool> SendAccessDenied(IFirehose firehose, ChatMessage msg) { return(await SendAccessDenied(firehose, msg.ChannelId, msg.UserName)); }
public TimedFirehose(DateTime shutoffTime, IFirehose firehose) : base() { ShutoffTime = shutoffTime; Delegate = firehose; }
public IndexSpecBuilder SetFirehose(IFirehose firehose) { _spec.Spec.IoConfig.Firehose = firehose; return(this); }
public Dan(IFirehose firehose) { m_firehose = firehose; }