本文整理汇总了C#中Winter.WinterBot.CanUseCommand方法的典型用法代码示例。如果您正苦于以下问题:C# WinterBot.CanUseCommand方法的具体用法?C# WinterBot.CanUseCommand怎么用?C# WinterBot.CanUseCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Winter.WinterBot
的用法示例。
在下文中一共展示了WinterBot.CanUseCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: UnknownCommandReceived
void UnknownCommandReceived(WinterBot sender, TwitchUser user, string cmd, string value)
{
cmd = cmd.ToLower();
Command command;
lock (m_sync)
if (!m_commands.TryGetValue(cmd, out command))
return;
if (!sender.CanUseCommand(user, command.AccessLevel))
{
WinterBotSource.Log.DenyCommand(user.Name, cmd, "access");
return;
}
if (CanSendCommand(user, cmd))
{
sender.SendResponse(Importance.Low, command.Text);
m_sent.AddLast(new Tuple<string, DateTime>(cmd, DateTime.Now));
}
}