Stuff
public text v1 · immutable case "verify":
if (e.Args.Length == 1)
{
try
{
string rhname;
int rhid;
try
{
rhid = Convert.ToInt32(e.Args[0]);
rhname = "";
}
catch
{
rhid = -1;
rhname = e.Args[0];
}
using (DbCommand command = Bot.Config.Connection.CreateCommand())
{
bool empty = true;
if (rhid > 0 || rhname != "")
{
if (rhid > 0)
command.CommandText = "SELECT [rh_date], [rh_name], [rh_min], [rh_max], [rh_result], [rh_type] FROM [RollHistory] WHERE [rh_id] = " + rhid + " LIMIT 1";
else if (rhname != "")
command.CommandText = "SELECT [rh_date], [rh_name], [rh_min], [rh_max], [rh_result], [rh_type] FROM [RollHistory] WHERE [rh_name] LIKE '" + Config.EscapeString(rhname) + "'";
DbDataReader reader = command.ExecuteReader();
// somewhere here it goes into catch
while (reader.Read())
{
empty = false;
if (rhid > 0)
{
if (reader.GetInt32(5) == 0)
Bot.SendReply(e, "Verify »» " + Bot.UppercaseFirst(reader.GetString(1)) + " asked me to roll between " + HTML.CreateColorString(sender.ColorHeaderHex, reader.GetInt32(2).ToString()) + " and " + HTML.CreateColorString(sender.ColorHeaderHex, reader.GetInt32(3).ToString()) + " at " + TimeStamp.ToDateTime(reader.GetInt32(2)).ToUniversalTime() + ". I replied that I rolled " + HTML.CreateColorString(sender.ColorHeaderHex, reader.GetInt32(4).ToString()) + ".");
else
{
if (reader.GetInt32(4) == 1)
landingname = "Tail";
else
landingname = "Head";
Bot.SendReply(e, "Verify »» " + Bot.UppercaseFirst(reader.GetString(1)) + " asked me to flip a coin at " + TimeStamp.ToDateTime(reader.GetInt32(2)).ToUniversalTime() + ". I replied that it landed with " + HTML.CreateColorString(sender.ColorHeaderHex, landingname + "s up") + ".");
}
}
else if (rhname != "")
{
RichTextWindow replyWindow = new RichTextWindow(this.Bot);
replyWindow.AppendTitle("Verify");
replyWindow.AppendNormal(" ");
//TimeStamp.ToDateTime(reader.GetInt64(2)).ToUniversalTime()
// " + HTML.CreateColorString(sender.ColorHeaderHex, reader.GetInt64(4)) + "
//replyWindow.AppendHighlight(+", By: " + reader.GetString(1));
replyWindow.AppendLineBreak();
replyWindow.AppendNormal(reader.GetString(3));
Bot.SendReply(e, replyWindow.ToString("click here"));
}
// reader.GetInt64(0);
}
reader.Close();
}
if (rhname == "" && rhid < 1)
Bot.SendReply(e, "Verify »» Syntax error: [id] got to be positive.");
else if (empty == true)
Bot.SendReply(e, "Verify »» This person/id does not exist in my memory.");
}
}
catch (Exception ex)
{
Bot.SendReply(e, "Verify »» " + ex.TargetSite);
}
}
else
{
Bot.SendReply(e, "Verify »» Syntax is: verify [id] or verify [name] for a list.");
}
break;