本文整理汇总了C#中Winter.WinterBot类的典型用法代码示例。如果您正苦于以下问题:C# WinterBot类的具体用法?C# WinterBot怎么用?C# WinterBot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WinterBot类属于Winter命名空间,在下文中一共展示了WinterBot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Kill
public void Kill(WinterBot bot, TwitchUser user, string cmd, string value)
{
bot.WriteDiagnostic(DiagnosticFacility.Info, "Bot killed by streamer.");
WinterBotSource.Log.Kill();
bot.Shutdown();
}
示例2: bot_MessageReceived
void bot_MessageReceived(WinterBot sender, TwitchUser user, string text)
{
if (m_lastStop.Elapsed().TotalSeconds < m_options.VoteClearTimer)
return;
if (m_active && m_lastVote.Elapsed().TotalSeconds >= m_options.VoteTimeout)
Reset(sender);
int result = -1;
for (int i = 1; i <= m_options.MaxVoteValue; ++i)
{
if (text.Contains(i.ToString()))
{
if (result != -1)
{
result = -1;
break;
}
result = i;
}
}
if (result != -1)
{
m_result[user] = result;
m_lastVote = DateTime.Now;
m_dirty = true;
if (!m_active)
{
m_lastMessage = DateTime.Now;
m_active = true;
}
}
}
示例3: bot_ViewerCountChanged
void bot_ViewerCountChanged(WinterBot sender, int currentViewerCount)
{
m_viewerSeconds += (long)m_lastUpdate.Elapsed().TotalSeconds * currentViewerCount;
m_lastUpdate = DateTime.Now;
WriteLine("{0} viewers.", currentViewerCount);
}
示例4: Init
public static void Init(WinterBot bot)
{
bot.AddCommands(new JukeBox(bot));
bot.AddCommands(new Betting(bot));
bot.AddCommands(new ViewerCountLogger(bot));
bot.AddCommands(new Insult(bot));
}
示例5: bot_StreamOnline
void bot_StreamOnline(WinterBot sender)
{
WriteLine("Stream online.");
m_lastUpdate = DateTime.Now;
m_viewerSeconds = 0;
}
示例6: JukeBoxCommand
public void JukeBoxCommand(WinterBot sender, TwitchUser user, string cmd, string value)
{
if (!m_enabled)
{
if (!sender.CanUseCommand(user, AccessLevel.Mod))
{
if (m_lastMessage.Elapsed().TotalSeconds <= 30)
return;
m_lastMessage = DateTime.Now;
sender.SendResponse(Importance.Low, "The jukebox is CLOSED. No additional requests are being accepted.");
return;
}
value = value.Trim().ToLower();
if (value == "on")
{
m_enabled = true;
m_lastMessage = DateTime.Now;
sender.SendResponse(Importance.Med, "Jukebox activated. Use '!JukeboxMode off' to deactivate.");
}
else if (value == "off")
{
sender.SendResponse(Importance.Med, "Jukebox mode is off.");
}
else
{
sender.SendResponse(Importance.Low, "Usage: '!jukebox on' and '!jukebox off'. Mod only.");
}
}
else
{
if (sender.CanUseCommand(user, AccessLevel.Mod))
{
if (value == "on")
{
sender.SendResponse(Importance.Low, "Jukebox mode is already enabled.");
}
else if (value == "off")
{
sender.SendResponse(Importance.High, "The jukebox is shutting down for the night. Please hold your song requests for next time.");
m_enabled = false;
}
else
{
SendMessage(sender);
}
}
else
{
if (m_lastMessage.Elapsed().TotalSeconds <= 10)
return;
m_lastMessage = DateTime.Now;
SendMessage(sender);
}
}
}
示例7: BettingSystem
public BettingSystem(WinterBot bot, WinterOptions options)
{
m_options = options;
m_bot = bot;
Enabled = true;
HttpManager.Instance.GetAsync("points.php", LoadPoints);
}
示例8: ViewerCountLogger
public ViewerCountLogger(WinterBot bot)
{
m_queue = new StringQueue(bot, "viewers");
bot.ViewerCountChanged += bot_ViewerCountChanged;
bot.StreamOnline += bot_StreamOnline;
bot.StreamOffline += bot_StreamOffline;
}
示例9: Banliust
public void Banliust(WinterBot sender, TwitchUser user, string cmd, string value)
{
if (string.IsNullOrWhiteSpace(value))
return;
UrlMatch match = new UrlMatch(sender, value);
m_urlBanlist.Add(match);
sender.SendResponse(Importance.Med, "Added {0} to the url ban list.", value);
}
示例10: BettingSystem
public BettingSystem(WinterBot bot, WinterOptions options)
{
m_options = options;
m_bot = bot;
Enabled = true;
m_http = new HttpManager(options);
m_http.GetAsync("points.php", LoadPoints);
}
示例11: ViewerCountLogger
public ViewerCountLogger(WinterBot bot, WinterOptions options)
: base(bot)
{
m_bot = bot;
m_options = options;
m_http = new HttpManager(options);
bot.ViewerCountChanged += bot_ViewerCountChanged;
}
示例12: AutoPoll
public AutoPoll(WinterBot bot)
{
m_options = bot.Options.AutoPollOptions;
if (!m_options.Enabled)
return;
bot.MessageReceived += bot_MessageReceived;
bot.Tick += bot_Tick;
}
示例13: Init
public static void Init(WinterBot bot)
{
WinterOptions options = new WinterOptions(bot.Options);
bot.AddCommands(new JukeBox(bot, options));
bot.AddCommands(new BettingSystem(bot, options));
bot.AddCommands(new ViewerCountLogger(bot, options));
new ChatSaver(bot, options);
bot.AddCommands(new BetterCommands(bot, options));
}
示例14: TimeoutController
public TimeoutController(WinterBot bot)
{
m_winterBot = bot;
LoadOptions(bot.Options);
m_denyList = new UserSet(bot, "deny");
m_winterBot.MessageReceived += CheckMessage;
ThreadPool.QueueUserWorkItem(LoadEmoticons);
}
示例15: 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;
}