1 #**************************************************************************
2 # Copyright (C) 2009 by Michael Andreen <harvATruinDOTnu> *
4 # This program is free software; you can redistribute it and/or modify *
5 # it under the terms of the GNU General Public License as published by *
6 # the Free Software Foundation; either version 2 of the License, or *
7 # (at your option) any later version. *
9 # This program is distributed in the hope that it will be useful, *
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 # GNU General Public License for more details. *
14 # You should have received a copy of the GNU General Public License *
15 # along with this program; if not, write to the *
16 # Free Software Foundation, Inc., *
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 #**************************************************************************/
20 package NDIRC::Commands::Members;
27 use MooseX::MethodAttributes;
30 : Help(Show current calls)
33 my ($self,$c,$msg) = @_;
34 my $f = $c->model->prepare(q{
35 SELECT (c.landing_tick - tick()) AS eta, concat(i.shiptype||'/') AS shiptype
38 JOIN incomings i ON i.call = c.id
39 LEFT OUTER JOIN users dc ON dc.uid = c.dc
40 JOIN users u ON u.uid = c.member
41 WHERE open AND (c.landing_tick - tick()) >= 7
42 GROUP BY c.id,c.landing_tick,dc.username
43 ORDER BY c.landing_tick;
47 while (my @row = $f->fetchrow()){
49 my $dc = $row[2] // '';
50 $calls .= " (Anti $row[1] ETA: $row[0] DC: $dc) |"
53 if ($msg ne 'q' || length $calls > 0){
54 $c->reply("Current calls: $calls");
59 : Help(List currently open raids)
62 my ($self,$c,$msg) = @_;
64 my $f = $c->model->prepare(q{
66 WHERE open AND not removed AND tick + waves - 7 > tick()
67 AND id IN (SELECT raid FROM raid_access WHERE gid = 2)
71 while (my ($raid) = $f->fetchrow()){
72 $calls .= " https://nd.ruin.nu/raids/view/$raid |"
74 $calls = "No open future raids" if ($f->rows == 0);
80 : Help(syntax: .points [nick] | not everyone have access to check for others.)
82 my ($self,$c,$msg) = @_;
85 if ($msg =~ /(\S+)/ && $c->check_user_roles(qw/irc_points_others/)){
87 $f = $c->model->prepare(q{
88 SELECT username, attack_points, defense_points, scan_points, humor_points
89 FROM users WHERE username ILIKE ? LIMIT 5
92 $f = $c->model->prepare(q{
93 SELECT username, attack_points, defense_points, scan_points, humor_points
94 FROM users WHERE hostmask ILIKE ?
98 while (my @row = $f->fetchrow()){
99 $c->reply("$row[0] has $row[1] Attack, $row[2] Defense, $row[3] Scan, $row[4] Humor points");
104 : Help(syntax: .sms nick | % can be used for wildcards %arro% will match barrow)
107 my ($self,$c,$msg) = @_;
108 my ($nick) = $msg =~ /(\S+)/ or die 'ARGS';
109 my $f = $c->model->prepare(q{
110 SELECT username,COALESCE(sms,'nothing added') FROM users WHERE username ILIKE ?
112 if (my ($username,$sms) = $c->model->selectrow_array($f,undef,$nick)){
113 $c->reply("<b>$username</b> has sms <b>$sms</b>");
115 $c->reply("No hit, maybe spelling mistake, or add % as wildcard");
120 : Help(Shows link to webbie and maybe more links later)
122 my ($self,$c,$msg) = @_;
123 $c->reply("https://nd.ruin.nu/");
127 : Help(syntax: .forum [nick] | not everyone have access to check for others.)
129 my ($self,$c,$msg) = @_;
133 if ($msg =~ /(\S+)/ && $c->check_user_roles('irc_forum_others')){
134 $user = $dbh->selectrow_hashref(q{
135 SELECT uid,username FROM users WHERE username ILIKE ?
138 $user = $dbh->selectrow_hashref(q{
139 SELECT uid,username FROM users WHERE hostmask ILIKE ?
143 my $unread = $dbh->selectrow_hashref(q{SELECT * FROM unread_posts($1)},undef,$user->{uid});
145 $c->reply("$user->{username} has $unread->{new} posts since your last forum visit ($unread->{unread} unread posts in total) https://nd.ruin.nu/forum/allUnread");