Sfoglia il codice sorgente

Should work now with public channels?

Andy Baugh 5 anni fa
parent
commit
0e941fab8e
1 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 7 4
      lib/Cpanel/iContact/Provider/Telegram.pm

+ 7 - 4
lib/Cpanel/iContact/Provider/Telegram.pm

@@ -68,18 +68,21 @@ sub send {
     my $api = WWW::Telegram::BotAPI->new(
         token => $self->{'contact'}{'TELEGRAMBOTTOKEN'},
     );
-    $api->getMe(); # Should explode if bogus?
+
+    # Test the auth. Will die if it fails.
+    $api->getMe();
 
     my $subject = $args_hr->{'subject'};
     my $message = $args_hr->{'text_body'};
+    print $message;
 
     # Send it
     foreach my $destination ( @{ $args_hr->{'to'} } ) {
         try {
-            $api->sendMessage(
+            $api->sendMessage({
                 'chat_id' => $destination,
-                'text'    => $message,
-            );
+                'text'    => $$message,
+            });
         }
         catch {
             require Cpanel::Exception;