本文整理汇总了C#中Winter.WinterBot类的典型用法代码示例。如果您正苦于以下问题:C# WinterBot类的具体用法?C# WinterBot怎么用?C# WinterBot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WinterBot类属于Winter命名空间,在下文中一共展示了WinterBot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:7,代码来源:BotControl.cs
示例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;
}
}
}
开发者ID:holyjaw,项目名称:WinterBot,代码行数:35,代码来源:AutoPoll.cs
示例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);
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:7,代码来源:ViewerCountLogger.cs
示例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));
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:7,代码来源:Plugin.cs
示例5: bot_StreamOnline
void bot_StreamOnline(WinterBot sender)
{
WriteLine("Stream online.");
m_lastUpdate = DateTime.Now;
m_viewerSeconds = 0;
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:7,代码来源:ViewerCountLogger.cs
示例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);
}
}
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:59,代码来源:JukeBox.cs
示例7: BettingSystem
public BettingSystem(WinterBot bot, WinterOptions options)
{
m_options = options;
m_bot = bot;
Enabled = true;
HttpManager.Instance.GetAsync("points.php", LoadPoints);
}
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:8,代码来源:Betting.cs
示例8: ViewerCountLogger
public ViewerCountLogger(WinterBot bot)
{
m_queue = new StringQueue(bot, "viewers");
bot.ViewerCountChanged += bot_ViewerCountChanged;
bot.StreamOnline += bot_StreamOnline;
bot.StreamOffline += bot_StreamOffline;
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:8,代码来源:ViewerCountLogger.cs
示例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);
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:9,代码来源:TimeoutController.cs
示例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);
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:9,代码来源:Betting.cs
示例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;
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:9,代码来源:ViewerCountLogger.cs
示例12: AutoPoll
public AutoPoll(WinterBot bot)
{
m_options = bot.Options.AutoPollOptions;
if (!m_options.Enabled)
return;
bot.MessageReceived += bot_MessageReceived;
bot.Tick += bot_Tick;
}
开发者ID:holyjaw,项目名称:WinterBot,代码行数:9,代码来源:AutoPoll.cs
示例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));
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:10,代码来源:Plugin.cs
示例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);
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:10,代码来源:TimeoutController.cs
示例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;
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:12,代码来源:Insult.cs
示例16: bot_Tick
static void bot_Tick(WinterBot sender, TimeSpan timeSinceLastUpdate)
{
s_lastHeartbeat += timeSinceLastUpdate;
if (s_messages > 0 && s_lastHeartbeat.TotalMinutes >= 5)
{
WriteLine("Messsages: {0}", s_messages);
s_messages = 0;
s_lastHeartbeat = new TimeSpan();
}
}
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:11,代码来源:Program.cs
示例17: ViewerCountLogger
public ViewerCountLogger(WinterBot bot, WinterOptions options)
: base(bot)
{
if (!bot.Channel.Equals("zlfreebird", StringComparison.CurrentCultureIgnoreCase))
return;
m_bot = bot;
m_options = options;
bot.ViewerCountChanged += bot_ViewerCountChanged;
}
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:11,代码来源:ViewerCountLogger.cs
示例18: BetterCommands
public BetterCommands(WinterBot bot, WinterOptions options)
: base(bot)
{
if (bot.Options.ChatOptions.UserCommandsEnabled)
return;
m_bot = bot;
m_options = options;
m_bot.UnknownCommandReceived += UnknownCommandReceived;
HttpManager.Instance.GetAsync("api.php", "GETCMDS=1", Load);
}
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:12,代码来源:BetterCommands.cs
示例19: TimeoutController
public TimeoutController(WinterBot bot)
{
m_winterBot = bot;
LoadOptions(bot);
m_denyList = new UserSet(bot, "deny");
m_winterBot.MessageReceived += CheckMessage;
m_winterBot.ActionReceived += CheckAction;
m_winterBot.StreamOffline += StreamStateChange;
m_winterBot.StreamOnline += StreamStateChange;
}
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:12,代码来源:TimeoutController.cs
示例20: AddCommand
public void AddCommand(WinterBot sender, TwitchUser user, string c, string v)
{
Args args = v.ParseArguments(m_bot);
AccessLevel level = args.GetAccessFlag("ul", AccessLevel.Mod);
string cmdName = args.GetOneWord();
string cmdText = args.GetString();
if (string.IsNullOrWhiteSpace(cmdName) || string.IsNullOrWhiteSpace(cmdText) || args.Error != null)
{
sender.SendResponse(Importance.Med, m_addCommandUsage);
return;
}
if (cmdName[0] != '!')
{
sender.SendResponse(Importance.Med, string.Format("User commands must start with a '!'. {0}", m_addCommandUsage));
return;
}
else
{
cmdName = cmdName.Substring(1);
}
if (cmdText[0] == '.' || cmdText[0] == '/')
{
sender.SendResponse(Importance.Med, string.Format("Cannot create a command which starts with a '{0}'.", cmdText[0]));
return;
}
cmdName = cmdName.ToLower();
Command userCommand = new Command(level, cmdText);
bool exists;
lock (m_sync)
{
exists = m_commands.ContainsKey(cmdName);
m_commands[cmdName] = userCommand;
m_dirty = true;
}
if (exists)
{
sender.SendResponse(Importance.Med, string.Format("Updated command: !{0}.", cmdName));
WinterBotSource.Log.AddCommand(user.Name, cmdName, cmdText);
}
else
{
sender.SendResponse(Importance.Med, string.Format("Successfully added command: !{0}.", cmdName));
WinterBotSource.Log.UpdateCommand(user.Name, cmdName, cmdText);
}
}
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:52,代码来源:BetterCommands.cs
注:本文中的Winter.WinterBot类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论