本文整理匯總了C#中Winter.WinterBot.WriteDiagnostic方法的典型用法代碼示例。如果您正苦於以下問題:C# WinterBot.WriteDiagnostic方法的具體用法?C# WinterBot.WriteDiagnostic怎麽用?C# WinterBot.WriteDiagnostic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Winter.WinterBot
的用法示例。
在下文中一共展示了WinterBot.WriteDiagnostic方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: SetRegular
private void SetRegular(WinterBot sender, string cmd, string value, bool regular)
{
value = value.Trim();
if (!TwitchUsers.IsValidUserName(value))
{
sender.WriteDiagnostic(DiagnosticFacility.UserError, "{0}: Invalid username '{1}.", cmd, value);
return;
}
TwitchUser target = sender.Users.GetUser(value);
target.IsRegular = regular;
sender.SendResponse(Importance.Med, "{0} {1} the regular list.", target.Name, regular ? "added to " : "removed from");
}
示例3: SetRegular
private void SetRegular(WinterBot sender, string cmd, string value, bool regular)
{
value = value.Trim().ToLower();
if (!TwitchUsers.IsValidUserName(value))
{
sender.WriteDiagnostic(DiagnosticFacility.UserError, "{0}: Invalid username '{1}.", cmd, value);
return;
}
TwitchUser target = sender.Users.GetUser(value);
if (regular)
{
sender.AddRegular(target);
sender.SendResponse("{0} added to regular list.", value);
}
else
{
sender.RemoveRegular(target);
sender.SendResponse("{0} removed from regular list.", value);
}
}
示例4: WordMatch
public WordMatch(WinterBot bot, string str)
{
m_str = str.ToLower();
if (str.IsRegex())
{
try
{
m_reg = new Regex(str, RegexOptions.IgnoreCase);
}
catch (ArgumentException)
{
bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
}
}
}
示例5: UrlMatch
public UrlMatch(WinterBot bot, string str)
{
if (str.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase))
str = str.Substring(7);
m_str = str.ToLower();
if (str.IsRegex())
{
try
{
m_reg = new Regex(str, RegexOptions.IgnoreCase);
}
catch (ArgumentException)
{
bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
}
}
}
示例6: ChangeMode
private static bool ChangeMode(WinterBot sender, TwitchUser user, string value, string type, bool curr)
{
bool result = curr;
value = value.Trim();
if (string.IsNullOrWhiteSpace(value))
{
sender.SendResponse(Importance.Med, "{0} protect is currently {1}.", type, curr ? "enabled" : "disabled");
}
else if (value.ParseBool(ref result))
{
if (curr != result)
{
string enableStr = result ? "enabled" : "disabled";
sender.SendResponse(Importance.Med, "{0} protect is now {1}.", type, enableStr);
sender.WriteDiagnostic(DiagnosticFacility.ModeChange, "{0} changed {1} mode to {2}.", user.Name, type, enableStr);
}
}
return result;
}