Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added !deletegithubproject functionality. Also fixed warning in PullR…

…equests.pm
  • Loading branch information...
commit 94aa0a4e9a1891ad6baa81cd8ee152da2cb94f0e 1 parent 5629b7a
@throughnothing throughnothing authored
View
26 lib/Bot/BasicBot/Pluggable/Module/GitHub.pm
@@ -202,9 +202,29 @@ sub said {
);
return "OK, set project for $channel: $project";
- } elsif ($mess->{body} =~ /^!deletegithubproject/i) {
- #TODO:
- return "Not Implemented!"
+ } elsif ($mess->{body} =~ m{
+ ^!deletegithubproject \s+
+ (?<channel> \#\S+ ) \s+
+ (?<project> \S+\/\S+)+
+ }xi) {
+ my ($channel, $project) = ($+{channel}, $+{project});
+ my $projects_for_channel =
+ $self->store->get('GitHub','projects_for_channel') || {};
+ my $projects = $projects_for_channel->{$channel} || [];
+
+ # Check if project already exists
+ for (1..@$projects){
+ if ($projects->[$_] eq $project){
+ delete $projects->[$_];
+ delete $net_github{$project};
+ }
+ }
+ $projects_for_channel->{$channel} = $projects;
+ $self->store->set(
+ 'GitHub', 'projects_for_channel', $projects_for_channel
+ );
+
+ return "OK, deleted project for $channel: $project";
} elsif ($mess->{body} =~ /^!showgithubprojects/i){
my $message;
my $projects_for_channel =
View
2  lib/Bot/BasicBot/Pluggable/Module/GitHub/PullRequests.pm
@@ -37,7 +37,7 @@ sub said {
return unless $project;
# Search through all the projects to see if the search word matches
- my $project = $self->search_projects($mess->{channel}, $search)
+ $project = $self->search_projects($mess->{channel}, $search)
|| $project;
if (!$project) {
Please sign in to comment.
Something went wrong with that request. Please try again.