本文整理汇总了C#中Winter.WinterBot.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# WinterBot.SendMessage方法的具体用法?C# WinterBot.SendMessage怎么用?C# WinterBot.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Winter.WinterBot
的用法示例。
在下文中一共展示了WinterBot.SendMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsultUser
//[BotCommand(AccessLevel.Normal, "insult")]
public void InsultUser(WinterBot sender, TwitchUser user, string cmd, string value)
{
value = value.Trim().ToLower();
if (TwitchUsers.IsValidUserName(value))
user = sender.Users.GetUser(value);
if (m_last.Elapsed().Minutes >= 1)
sender.SendMessage("{0}, {1}", user.Name, m_insults[m_random.Next(m_insults.Length)]);
m_last = DateTime.Now;
}
示例2: bot_MessageReceived
void bot_MessageReceived(WinterBot sender, TwitchUser user, string text)
{
if (!user.Name.Equals("frostysc", StringComparison.CurrentCultureIgnoreCase))
return;
if (m_random.Next(200) != 7)
return;
if (m_last.Elapsed().Minutes >= 5)
sender.SendMessage("{0}, {1}", user.Name, m_insults[m_random.Next(m_insults.Length)]);
m_last = DateTime.Now;
}
示例3: bot_Tick
void bot_Tick(WinterBot sender, TimeSpan timeSinceLastUpdate)
{
if (m_lastMessage.Elapsed().TotalMinutes >= m_msgOptions.Delay &&
m_totalMessages >= m_msgOptions.MessageDelay &&
sender.LastMessageSent.Elapsed().TotalSeconds >= 45)
{
m_lastMessage = DateTime.Now;
m_totalMessages = 0;
var messages = m_msgOptions.Messages;
if (messages.Length == 0)
return;
m_curr %= messages.Length;
string msg = null;
if (m_random != null)
msg = messages[m_random.Next(messages.Length)];
else
msg = messages[m_curr++];
sender.SendMessage(msg);
}
}
示例4: SendMessage
private void SendMessage(WinterBot sender, string fmt, params object[] args)
{
if (m_lastMessage.Elapsed().Seconds < 20)
return;
sender.SendMessage(Importance.Low, string.Format(fmt, args));
m_lastMessage = DateTime.Now;
}
示例5: m_bot_Tick
void m_bot_Tick(WinterBot sender, TimeSpan timeSinceLastUpdate)
{
if (!IsBettingOpen)
{
sender.SendMessage(Importance.High, "Betting is now CLOSED.");
CancelCallback();
return;
}
if (m_bettingStarted.Elapsed().TotalSeconds >= m_time)
{
sender.SendMessage(Importance.High, "Betting is now CLOSED.");
CancelCallback();
m_state = State.WaitingResult;
}
}
示例6: Result
public void Result(WinterBot sender, TwitchUser user, string cmd, string value)
{
if (!Enabled)
return;
if (IsBettingClosed)
{
sender.SendMessage(Importance.Med, "Betting is not currently open.");
return;
}
Args args = value.ParseArguments(sender);
string result = args.GetOneWord();
if (string.IsNullOrWhiteSpace(result))
{
sender.SendMessage(Importance.Med, "Usage: '!result [player]'.");
return;
}
else if (!m_betting.Contains(result))
{
sender.SendMessage(Importance.High, "'{0}' not a valid player, valid players: {1}", result, string.Join(", ", m_betting));
return;
}
var winners = from bet in m_bets
where bet.Value.Item1.Equals(result, StringComparison.CurrentCultureIgnoreCase)
select bet;
var losers = from bet in m_bets
where !bet.Value.Item1.Equals(result, StringComparison.CurrentCultureIgnoreCase)
select bet;
int totalWinners = 0, totalLosers = 0;
foreach (var winner in winners)
{
AddPoints(winner.Key, winner.Value.Item2);
totalWinners++;
}
foreach (var loser in losers)
{
AddPoints(loser.Key, -loser.Value.Item2);
totalLosers++;
}
Tuple<TwitchUser, int>[] t = (from bet in m_bets
select new Tuple<TwitchUser, int>(bet.Key, m_points[bet.Key])).ToArray();
lock (m_sync)
foreach (var usr in m_bets.Keys)
m_queue.Add(new Tuple<TwitchUser, int>(usr, m_points[usr]));
m_event.Set();
ClearBetting();
CancelCallback();
sender.SendMessage(Importance.High, "Betting complete. {0} winners and {1} losers. Point totals can be found here: http://www.darkautumn.net/winter/chat.php?POINTS", totalWinners, totalLosers);
}
示例7: BettingEnable
public void BettingEnable(WinterBot sender, TwitchUser user, string cmd, string value)
{
bool enable = false;
if (!value.ParseBool(ref enable))
{
sender.SendMessage(Importance.Low, "Betting is currently: {0}", Enabled ? "enabled" : "disabled");
return;
}
Enabled = enable;
sender.SendMessage(Importance.Med, "Betting is now {0}.", Enabled ? "enabled" : "disabled");
}
示例8: bot_UserSubscribed
void bot_UserSubscribed(WinterBot sender, TwitchUser user)
{
var subMessage = m_chatOptions.SubscribeMessage;
if (!string.IsNullOrWhiteSpace(subMessage))
sender.SendMessage("{0}: {1}", user.Name, subMessage);
}
示例9: bot_UserFollowed
private void bot_UserFollowed(WinterBot sender, TwitchUser user)
{
var msg = m_chatOptions.FollowMessage;
if (!string.IsNullOrWhiteSpace(msg))
sender.SendMessage("{0}: {1}", user.Name, msg);
}
示例10: ListCommands
public void ListCommands(WinterBot sender, TwitchUser user, string cmd, string value)
{
if (m_lastCommandList.Elapsed().TotalSeconds < 15)
{
WinterBotSource.Log.DenyCommand(user.Name, cmd, "time");
return;
}
m_lastCommandList = DateTime.Now;
sender.SendMessage("A full listing of user commands can be found here: " + HttpManager.Instance.GetUrl("commands.php"));
m_sent.AddLast(new Tuple<string, DateTime>("commands", DateTime.Now));
}