本文整理匯總了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));
}
}