1 ################################
3 ################################
5 package BotModules::Wishlist;
14 '' => 'A module to store wishlist items, typically used to file bugs on the bot, but really for that you should use Bugzilla -- https://bugzilla.mozilla.org/ -- component MozBot in product Webtools.',
15 'wish' => 'Adds an item to the wishlist. Please use Bugzilla for this purpose though, see https://bugzilla.mozilla.org/ product Webtools, component Mozbot. Syntax: \'wish <text of wish>\'',
16 'wishes' => 'Causes the bot to list all the wishes that have been made. Since this may be long, it may only be done in a /msg. Syntax: \'wishes\'',
18 $$reply{''} .= ' To remove wishes, use the following command: vars Wishlist wishes \'-<full text of the wish to remove>\'' if $self->isAdmin($event);
22 # RegisterConfig - Called when initialised, should call registerVariables
25 $self->SUPER::RegisterConfig(@_);
26 $self->registerVariables(
27 # [ name, save?, settable? ]
29 ['reply', 1, 1, 'Noted!'],
35 my ($event, $message) = @_;
36 if ($message =~ /^\s*(?:i\s+)?wish(?:list)?[-\s:.,;!]+(...+?)\s*$/osi) {
37 push(@{$self->{'wishes'}}, "<$event->{'from'}> $1");
38 $self->say($event, "$event->{'from'}: $self->{'reply'}");
40 } elsif ($message =~ /^\s*wishes[\s?]*$/osi) {
41 if (@{$self->{'wishes'}}) {
42 $self->directSay($event, 'Wishes:');
43 foreach (@{$self->{'wishes'}}) {
44 $self->directSay($event, " $_");
46 $self->directSay($event, 'End of wishes.');
48 $self->directSay($event, 'No-one has wished for anything!');
50 $self->channelSay($event, "$event->{'from'}: wishlist /msg'ed");
52 return $self->SUPER::Told(@_);
54 return 0; # we've dealt with it, no need to do anything else.