forked from fastmail/Synergy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththings-to-port
70 lines (57 loc) · 2.17 KB
/
things-to-port
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!perl
my %alias = (
'+x' => 'addchecklist',
);
sub said_whats {
my ($self, $arg) = @_;
return $self->SAID_what({ %$arg, what => "is $arg->{what}" });
}
sub _fmt_ph {
my ($self, $ph) = @_;
my ($c, $ac, $ex, $rest) = $ph =~ m{
\A
([0-9])? ([0-9]{3}) ([0-9]{3}) ([0-9]{4})
\z
}x;
$c //= 1;
return "+$c $ac $ex-$rest";
}
sub SAID_what {
my ($self, $arg) = @_;
my $what = $arg->{what};
$what =~ s/\s*\?*\z//;
return -1 unless $what =~ s/\Ais //;
if ($what =~ /\Ayour (?:phone )?number\z/) {
my $num = $self->_fmt_ph($config->{twilio}{from});
return $self->reply("You can text me at $num.", $arg);
}
if ($what =~ /\A(\S+?)(?:'s)? (?:phone )?number\z/) {
my $who = $1;
my $user = $self->resolve_name($who, $arg->{who});
my $name = $user ? $user->username : $who;
return $self->reply("I don't have a number on file for $name.", $arg)
unless $user && $user->has_phone;
my $num = $self->_fmt_ph($user->phone);
return $self->reply(
sprintf("You can reach %s at %s.", $user->username, $user->phone),
$arg,
);
}
return -1;
}
my %HELP = (
abort => "abort timer -- stop and clear the timer (LP users only)",
ack => "ack ALERTID [for DURATION] -- acknowledge an alert",
alerts => "alerts -- list active Circonus alerts",
announce => "announce MESSAGE -- say something on IRC, for use via SMS",
chill => "chill [until TIME | for DURATION] -- stop nagging for a while (LP users only)",
oncall => "oncall -- list on call users; also, (oncall add SOMEBODY, oncall remove SOMEBODY, oncall set SOMEBODY...)",
reset => "reset timer -- clear the timer, leave it running (LP user onlys)",
showtime => "showtime -- stop chilling, start nagging",
start => "start [TASKID] -- start next upcoming task, or task ID TASKID ",
tasks => "tasks [ N ] -- see your upcoming 5 tasks, or 'page' N of your tasks ",
timer => "timer -- show timer status (LP users only)",
stop => "stop timer -- stop the current timer (LP users only)",
task => "task for SOMEBODY: TASK -- make a new task in Liquid Planner",
what => "what's SOMEBODY's number -- get a user's phone number",
);