voice.pm 856 B

12345678910111213141516171819202122232425262728293031
  1. use POE;
  2. {
  3. control_commands => {
  4. voice => sub {
  5. my ($client, $data, @args) = @_;
  6. if (!$BotIrc::irc->is_channel_member($BotIrc::config->{voice_channel}, $args[0])) {
  7. $client->put("error:notinchan:That user couldn't be found in the channel.");
  8. } else {
  9. $BotIrc::irc->yield(mode => $BotIrc::config->{voice_channel} => "+v" => $args[0]);
  10. $client->put("ok");
  11. }
  12. },
  13. },
  14. irc_commands => {
  15. voice => sub {
  16. my ($source, $targets, $args, $account) = @_;
  17. BotIrc::check_ctx() or return 1;
  18. my $nick = BotIrc::nickonly($source);
  19. if (!$BotIrc::irc->is_channel_member($BotIrc::config->{voice_channel}, $nick)) {
  20. BotIrc::send_noise("What? You're not even in $BotIrc::config->{voice_channel}!");
  21. return 1;
  22. }
  23. $BotIrc::irc->yield(mode => $BotIrc::config->{voice_channel} => "+v" => $source);
  24. return 1;
  25. },
  26. },
  27. };