- $f->execute($nick);
- while (my @row = $f->fetchrow()){
- $c->reply("$row[0] has $row[1] Attack, $row[2] Defense, $row[3] Scan, $row[4] Humor points");
+};
+
+command sms => {
+ help => q(syntax: .sms nick | % can be used for wildcards %arro% will match barrow),
+ acl => q(irc_sms),
+}, class extends NDIRC::Command {
+ method execute($c,$msg) {
+ my ($nick) = $msg =~ /(\S+)/ or die 'ARGS';
+ my $f = $c->model->prepare(q{
+SELECT username,COALESCE(sms,'nothing added'), call_if_needed, timezone, sms_note
+ ,to_char(NOW() AT TIME ZONE timezone,'HH24:MI') AS time
+FROM users WHERE username ILIKE ?
+ });
+ if (my ($username,$sms, $call, $timezone, $note, $time) = $c->model->selectrow_array($f,undef,$nick)){
+ $call = $call ? 'Wake up if needed' : 'Do not wake up';
+ $c->reply("<b>$username</b> has sms <b>$sms</b>, $call, <b>$time</b> ($timezone), $note ");
+ }else{
+ $c->reply("No hit, maybe spelling mistake, or add % as wildcard");
+ }