mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
Spinach: add set/unset commands to modify metadata
This commit is contained in:
parent
781faa678b
commit
0b0390dbd7
@ -233,7 +233,7 @@ sub spinach_cmd {
|
||||
my ($self, $from, $nick, $user, $host, $arguments) = @_;
|
||||
$arguments =~ s/^\s+|\s+$//g;
|
||||
|
||||
my $usage = "Usage: spinach join|exit|ready|unready|choose|lie|reroll|skip|score|show|categories|filter|kick|abort; for more information about a command: spinach help <command>";
|
||||
my $usage = "Usage: spinach join|exit|ready|unready|choose|lie|reroll|skip|score|show|categories|filter|set|unset|kick|abort; for more information about a command: spinach help <command>";
|
||||
|
||||
my $command;
|
||||
($command, $arguments) = split / /, $arguments, 2;
|
||||
@ -312,6 +312,14 @@ sub spinach_cmd {
|
||||
return "Help is coming soon.";
|
||||
}
|
||||
|
||||
when ('set') {
|
||||
return "Help is coming soon.";
|
||||
}
|
||||
|
||||
when ('unset') {
|
||||
return "Help is coming soon.";
|
||||
}
|
||||
|
||||
default {
|
||||
if (length $arguments) {
|
||||
return "Spinach has no such command '$arguments'. I can't help you with that.";
|
||||
@ -862,6 +870,24 @@ sub spinach_cmd {
|
||||
}
|
||||
}
|
||||
|
||||
when ('set') {
|
||||
my ($index, $key, $value) = split /\s+/, $arguments;
|
||||
|
||||
if (not defined $index) {
|
||||
return "Usage: spinach set <metadata> [key [value]]";
|
||||
}
|
||||
return $self->{metadata}->set($index, $key, $value);
|
||||
}
|
||||
|
||||
when ('unset') {
|
||||
my ($index, $key) = split /\s+/, $arguments;
|
||||
|
||||
if (not defined $index or not defined $key) {
|
||||
return "Usage: spinach unset <metadata> <key>";
|
||||
}
|
||||
return $self->{metadata}->unset($index, $key);
|
||||
}
|
||||
|
||||
default {
|
||||
return $usage;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user