本文整理匯總了C#中Bot.Ban方法的典型用法代碼示例。如果您正苦於以下問題:C# Bot.Ban方法的具體用法?C# Bot.Ban怎麽用?C# Bot.Ban使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bot
的用法示例。
在下文中一共展示了Bot.Ban方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: cmd_ban
public static void cmd_ban(Bot bot, String ns, String[] args, String msg, String from, dAmnPacket packet)
{
String helpmsg = String.Format("<b>» Usage:</b> {0}ban <i>[#channel]</i> username", bot.Config.Trigger);
if (args.Length < 2)
{
bot.Say(ns, helpmsg);
}
else
{
String chan, who;
if (!args[1].StartsWith("#"))
{
chan = ns;
who = args[1];
}
else if (args.Length == 3)
{
chan = args[1];
who = args[2];
}
else
{
bot.Say(ns, helpmsg);
return;
}
lock (CommandChannels["send"])
{
CommandChannels["send"].Add(ns);
}
bot.Ban(chan, who);
}
}
示例2: ParseBDS
//.........這裏部分代碼省略.........
}
if (!Double.TryParse(versions[1], out bdsver))
bdsver = 0.2;
Types.BotInfo bot_info = new Types.BotInfo(from, data[1], data[2], botver, trig, bdsver, Bot.EpochTimestamp);
String hashkey = Tools.md5((trig + data[0] + from).ToLower().Replace(" ", "")).ToLower();
ClearKickTimers(from);
if (hashkey != hash)
{
// Invalid hash supplied
// For now, we ignore this. Though I'd like to see policebots send and error like:
// BDS:BOTCHECK:ERROR:INVALID_RESPONSE_HASH
// Police bot stuff.
if ((ns == "chat:DSGateway" || ns == "chat:DataShare") && IsPoliceBot(username, ns))
{
if (ns == "chat:DSGateway")
bot.NPSay(ns, "BDS:BOTCHECK:DENIED:" + from + ",Invalid BDS:BOTCHECK");
bot.Kick(ns, from, "No response to or invalid BDS:BOTCHECK. If you are not a bot, please do not join this room. Thanks.");
bot.Promote("chat:DataShare", from, "BrokenBots");
if (!Kicks.ContainsKey(from))
Kicks.Add(from, new KickInfo());
Kicks[from].Kick();
if (Kicks[from].Count >= 3)
{
bot.Ban(ns, from);
var t = new Timer(5000);
t.Elapsed += delegate { bot.UnBan(ns, from); };
t.Start();
}
}
if (Program.Debug)
ConIO.Warning("BDS", "Invalid hash for bot: " + from);
}
else
{
// Police bot stuff.
if ((ns == "chat:DSGateway" || ns == "chat:DataShare") && IsPoliceBot(username, ns))
{
if (ns == "chat:DSGateway")
{
if (!GateChecks.Contains(from))
GateChecks.Add(from);
bot.NPSay(ns, "BDS:BOTCHECK:OK:" + from);
}
bot.Promote("chat:DataShare", from, "Bots");
}
lock (_botinfo_database)
{
if (_botinfo_database.ContainsKey(from.ToLower()))
{
_botinfo_database[from.ToLower()] = bot_info;
if (Program.Debug)
ConIO.Write("Updated database for bot: " + from, "BDS");