News:

Wondering if this will always be free?  See why free is better.

Main Menu

Telegram Autopost Bot

Started by vbgamer45, April 11, 2020, 05:57:59 AM

Previous topic - Next topic

mpcgferreira

#80
Also may help

My second Solution for the error {"ok":true,"result":[]}

Go in your Telegram Group
Add new User (Invite)
Search for "getidsbot" => @getidsbot
Message: /start@getidsbot
Now you see the ID. looks like 1068773197, which is -1001068773197 for bots (with -100 prefix)!!!
Kick the bot from the Group.
Now go to the Webbrowser an send this line (Test Message):
https://api.telegram.org/botAPITOKENNUMBER:APITOKENKEYHERE/sendmessage?chat_id=-100GROUPNUMBER&text=test [nofollow]
Edit the API Token and the Group-ID!

mpcgferreira

These code work to check if data provided on the setup are good

https://api.telegram.org/botxxxxxxxxxxxxxxxxxx/sendmessage?chat_id=xxxxxxxxx&text=test [nofollow]

Only need replace xxx for your data.

----

So if code is good and work on the test. The MOD don´t work with the correct data. The problem ???????

mpcgferreira

Quote from: vbgamer45 on October 20, 2021, 02:15:48 PMIt might user bot id. I don't remember. I just remember it was not easy to find out. I had to talk to a bot on telegram to get the chat id.

Hello,
These code work to test if data provided on config are good. Any help please.

Code: https://api.telegram.org/botxxxxxxxxxxxxxxxxxx/sendmessage?chat_id=xxxxxxxxx&text=test [nofollow]
Result: "{"ok":true,"result":{"message_id":178,"from":{"id":2070000772,"is_bot":true,"first_name":"test_forum","username":"test_forum_bot"},"chat":{"id":-1001000012027,"title":"Test Forum News","username":"test_forum","type":"supergroup"},"date":1634009020,"text":"test"}}

wylekk

Hi! The mod works fine, but is it possible to make it so that not the link was to the last message but the message itself?

mpcgferreira

Quote from: wylekk on December 15, 2021, 09:27:12 AMHi! The mod works fine, but is it possible to make it so that not the link was to the last message but the message itself?

you make the mod work. i try all and nothing.

wylekk

How to get a Telegram API bot token

Create and configure a bot

You don't need to write code to do that. In fact, you don't need to use your computer! Just go to the Telegram app on your device and follow these 4 simple steps:

Step 1. Find a bot named "@botfarther" in the telegram, it will help you in creating and managing your bot.

You cannot view this attachment.

Step 2. Send him a "/help" and you'll see all the possible commands your bot can manage.

You cannot view this attachment.

Step 3. To create a new bot, send "/newbot".

Follow the instructions he gave and create a new name for your bot. If you are creating a bot only for experimentation, then the name must be unique, you can use the namespace of your bot by putting your name in front of it in the username. By the way, his pseudonym can be anything.

Step 4. You've just created your Telegram bot. You'll see the new API token generated for it.

Copy your API token (example - 7041085203:GAEo9l21OJdXlrOIDU2KdYHm9T0urAMPkh).

You cannot view this attachment.

Step 5. Telegram chat ID.

Write in the search @get_id_bot and choose this bot.

You cannot view this attachment.

Click Start.

You cannot view this attachment.

Copy the chat ID.

You cannot view this attachment.

mpcgferreira

Hello,
I made all that. I check for errors and when i publish something smf generate these error.

400:<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>

and


JSON Syntax error

Will Garcia

Quote from: goldenstudios on April 17, 2020, 06:25:59 AMI noticed, however, that the bot sends messages only to me..how did I force it to send messages in a public group?
when i send message show this:
/getgroupid
This is not a group! Stop fooling me!



How do I make it send the message to the group and not to me?

Pyrhel

Hello, the addon is great! I'm planning to give a channel to my members and use the messages as a feed for new posts for those who want to be informed for everything.

I managed to make it post to this public channel, but I found one drawback. It posts info about every post, even those which are not approved yet.

Is it possible this addon be upgraded to skip unapproved posts and send a notification at the moment when they are approved?

underc0de

Nice bot! Works perfect! But I don't why the auto publish doesn't display the image and text (the metadata)

Any idea?
Best Regards

Will Garcia

Is there a way to add not only one group but also 2 groups, some way to modify this mod to add 2 or more groups

vbgamer45

Possibly would have to check out the API. I don't use telegram though. I just signed up to check the api to make this originally.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Will Garcia

Quote from: vbgamer45 on June 17, 2023, 10:17:54 AMPossibly would have to check out the API. I don't use telegram though. I just signed up to check the api to make this originally.

I would appreciate your collaboration I already have oocos knowledge and I don't know how to do it oara ooder add 2 api and 2 id in the mod configuration to publish different topics in different groups

vbgamer45

Don't have time currently to work on this.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Will Garcia

Quote from: vbgamer45 on June 19, 2023, 09:11:09 AMDon't have time currently to work on this.

Thank you for your cooperation 8)

Will Garcia

Quote from: Will Garcia on June 19, 2023, 11:25:05 AM
Quote from: vbgamer45 on June 19, 2023, 09:11:09 AMDon't have time currently to work on this.

Thank you for your cooperation 8)
Quote from: vbgamer45 on June 19, 2023, 09:11:09 AMDon't have time currently to work on this.


I managed to advance something, but when I make a change it throws me this DB error



The database value you're trying to insert does not exist: value

vbgamer45

What file/edit did you change
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Will Garcia

Quote from: vbgamer45 on June 19, 2023, 12:56:23 PMWhat file/edit did you change

telegram.php

<?php
/*
Telegram Autopost
Version 1.0
by:vbgamer45
https://www.smfhacks.com

License Information:
Links to https://www.smfhacks.com must remain unless
branding free option is purchased.
*/

function telegramMain()
{
    
// Only admins can access Settings
    
isAllowedTo('admin_forum');

    
// Load the language files
    
if (loadlanguage('telegram') == false)
        
loadLanguage('telegram','english');

    
// Load template
    
loadtemplate('telegram2');

    
// Sub Action Array
    
$subActions = array(
        
'settings' => 'telegramSettings',
        
'settings2' => 'telegramSettings2',
    );

    if (isset(
$_REQUEST['sa']))
        
$sa $_GET['sa'];
    else
        
$sa '';

    if (!empty(
$subActions[$sa]))
        
$subActions[$sa]();
    else
        
telegramSettings();
}

function 
telegramSettings()
{
    global 
$txt$context$smcFunc;
    
    
$context['telegram_boards'] = array();
    
$request $smcFunc['db_query'](''"
                SELECT
                    b.ID_BOARD, b.name AS bName, c.name AS cName
                FROM {db_prefix}boards AS b, {db_prefix}categories AS c
                WHERE b.ID_CAT = c.ID_CAT ORDER BY c.cat_order, b.board_order"
);
    while (
$row $smcFunc['db_fetch_assoc']($request))
            
$context['telegram_boards'][$row['ID_BOARD']] = $row['cName'] . ' - ' $row['bName'];
    
$smcFunc['db_free_result']($request);
    

    
// Set template
    
$context['sub_template'] = 'telegram_settings';

    
// Set page title
    
$context['page_title'] = $txt['telegram_admin'];


    
$context[$context['admin_menu_name']]['tab_data'] = array(
            
'title' => $txt['telegram_admin'],
            
'description' => '',
            
'tabs' => array(
                
'settings' => array(
                    
'description' => $txt['telegram_txt_settings_desc'],
                ),


            ),
        );

}

function 
telegramSettings2()
{
    global 
$smcFunc;

    
// Security Check
    
checkSession('post');

    
$telegram_enable_bot_auth_token $smcFunc['htmlspecialchars']($_REQUEST['telegram_enable_bot_auth_token'],ENT_QUOTES);
    
$telegram_enable_chat_id $smcFunc['htmlspecialchars']($_REQUEST['telegram_enable_chat_id'],ENT_QUOTES);
    
    
$telegram_enable_bot_auth_token2 $smcFunc['htmlspecialchars']($_REQUEST['telegram_enable_bot_auth_token2'],ENT_QUOTES);
    
$telegram_enable_chat_id2 $smcFunc['htmlspecialchars']($_REQUEST['telegram_enable_chat_id2'],ENT_QUOTES);


    
// Settings
    
$telegram_enable_push_registration = isset($_REQUEST['telegram_enable_push_registration']) ? 0;
    
$telegram_enable_push_topic = isset($_REQUEST['telegram_enable_push_topic']) ? 0;
    
$telegram_enable_push_post = isset($_REQUEST['telegram_enable_push_post']) ? 0;
    
    
$telegram_boardstopush implode(",",$_REQUEST['telegram_boardstopush']);
    
$telegram_boardstopush2 implode(",",$_REQUEST['telegram_boardstopush2']);
    
    
$telegram_dateformat $smcFunc['htmlspecialchars']($_REQUEST['telegram_dateformat'],ENT_QUOTES);
    
$telegram_msg_reg $smcFunc['htmlspecialchars']($_REQUEST['telegram_msg_reg'],ENT_QUOTES);
    
$telegram_msg_topic $smcFunc['htmlspecialchars']($_REQUEST['telegram_msg_topic'],ENT_QUOTES);
    
$telegram_msg_post $smcFunc['htmlspecialchars']($_REQUEST['telegram_msg_post'],ENT_QUOTES);
    


        
updateSettings(
    array(
    
'telegram_enable_bot_auth_token' => $telegram_enable_bot_auth_token,
    
'telegram_enable_chat_id' => $telegram_enable_chat_id,
    
    
'telegram_enable_bot_auth_token2' => $telegram_enable_bot_auth_token2,
    
'telegram_enable_chat_id2' => $telegram_enable_chat_id2,

    
'telegram_enable_push_registration' => $telegram_enable_push_registration,
    
'telegram_enable_push_topic' => $telegram_enable_push_topic,
    
'telegram_enable_push_post' => $telegram_enable_push_post,
    

    
'telegram_boardstopush' => $telegram_boardstopush,
    
'telegram_boardstopush2' => $telegram_boardstopush2,
    
    
'telegram_dateformat' => $telegram_dateformat,
    
'telegram_msg_reg' => $telegram_msg_reg,
    
'telegram_msg_topic' => $telegram_msg_topic,
    
'telegram_msg_post' => $telegram_msg_post,
    

    
    ));

    
// Redirect to the admin area
    
redirectexit('action=admin;area=telegram;sa=settings');
}

function 
telegram_sendCURL($message)
{
    global 
$modSettings;
            
$ch curl_init();
            
curl_setopt($chCURLOPT_URL,  'https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token'].'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id'] . "&text="urlencode($message['text']));
            
curl_setopt($chCURLOPT_URL,  'https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token2'].'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id2'] . "&text="urlencode($message['text']));
            
curl_setopt($chCURLOPT_POSTtrue);
          
// curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
            
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($chCURLOPT_SSL_VERIFYHOST,0);
            
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
          
//  curl_setopt($ch, CURLOPT_POSTFIELDS,  http_build_query($message));
            
$result curl_exec($ch);
            
// Check for errors and display the error message
            
if ($errno curl_errno($ch))
            {
                
$error_message curl_strerror($errno);
                
log_error("cURL error ({$errno}):\n {$error_message}");
            }
            
$json_result json_decode($resulttrue);
            if ((
$httpcode curl_getinfo($chCURLINFO_HTTP_CODE)) != 204)
            {
                if (
$httpcode  != 200)
                    
log_error($httpcode ':' $result);
            }

            if (
$json_result === NULL)
            {
                
log_error('JSON '.json_last_error_msg());
                return 
NULL;
            }
            if (
$json_result['ok'] !== TRUE)
            {
                
log_error($json_result['description']);
                return 
NULL;
            }


            
curl_close($ch);
            return 
$result;
}

function 
telegram_sendSocket($message)
{
    global 
$modSettings;

    
$parsed parse_url('https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token'] .'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id'] . "&text="urlencode($message['text']));
    
$parsed parse_url('https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token2'] .'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id2'] . "&text="urlencode($message['text']));
            
$result '';
            if (
$f fsockopen((($parsed['scheme'] == 'https') ? 'ssl://' '') . $parsed['host'], (($parsed['scheme'] == 'https') ? 443 80), $errno$errmsg30)) {
                
$out "POST " $parsed['path'] . " HTTP/1.0\r\n";
                
$out .= "Host: " $parsed['host'] . "\r\n";
                
$out .= "Content-Length: " strlen($message) . "\r\n\r\n";
                
fwrite($f$out);
                while (!
feof($f))
                {
                    
$result .= fread($f4096);
                }
                
fclose($f);
            }
            return 
$result;
}

function 
telegram_send($message)
{
    global 
$modSettings;

    if (empty(
$modSettings['telegram_enable_chat_id']))
            return;

    if (empty(
$modSettings['telegram_enable_bot_auth_token']))
            return;
            
            if (empty(
$modSettings['telegram_enable_chat_id2']))
            return;

    if (empty(
$modSettings['telegram_enable_bot_auth_token2']))
            return;


            
$push = array(
            
'chat_id' => $modSettings['telegram_enable_chat_id'],
            
'chat_id' => $modSettings['telegram_enable_chat_id2'],
            
'disable_web_page_preview' => 'true',
            
'parse_mode' => 'HTML',
            
'text' => $message,
        );


          if (!
function_exists('curl_init')) 
                
telegram_sendSocket($push);
          else
                  
telegram_sendCURL($push);
          
}

function 
telegram_send_topic($messageid)
{
    global 
$modSettings$smcFunc$scripturl$txt;
    
    if (empty(
$modSettings['telegram_enable_push_topic']))
        return;
        
    if (empty(
$messageid))
        return;    
            
    
$message $modSettings['telegram_msg_topic'];
    
    
$t time();
    
$message str_replace("(date)",date($modSettings['telegram_dateformat'],$t),$message);
    
    
$request $smcFunc['db_query'](''"
                SELECT
                    mem.real_name, m.subject, b.name, m.id_topic, m.id_board 
                FROM {db_prefix}messages as m
                LEFT JOIN {db_prefix}members as mem ON (m.id_member = mem.id_member) 
                LEFT JOIN {db_prefix}boards as b ON (b.id_board = m.id_board) 
                WHERE m.id_msg = 
$messageid");
    
$row $smcFunc['db_fetch_assoc']($request);
    
$username $row['real_name'];
    
    if (empty(
$row['real_name']))
    {
        
// Load the language files
        
if (loadlanguage('telegram') == false)
            
loadLanguage('telegram','english');
            
        
$username $txt['telegram_guest'];
    }    
        
        
        
    
$message str_replace("(username)",$username,$message);
    
$message str_replace("(title)",$row['subject'],$message);
    
$message str_replace("(board)",$row['name'],$message);
    
$message str_replace("(url)",$scripturl '?topic=' $row['id_topic'] . '.msg' $messageid '#msg' $messageid,$message);
    
$message str_replace("(can_url)",$scripturl '?topic=' $row['id_topic'] . '.0',$message); // this one allows canonical url...
    
$message html_entity_decode($messageENT_QUOTES ENT_XML1'UTF-8');
    
    
// Check if this is in a board that is allowed to post
    
$boardlist explode(",",$modSettings['telegram_boardstopush']);
    
$boardlist explode(",",$modSettings['telegram_boardstopush2']);
    if (!
in_array($row['id_board'],$boardlist))
        return;    


    
telegram_send($message);
    
}

function 
telegram_send_post($messageid)
{
    global 
$modSettings$smcFunc$scripturl$txt;
    
    if (empty(
$modSettings['telegram_enable_push_post']))
        return;
        
        
    if (empty(
$messageid))
        return;    
        
    
$message $modSettings['telegram_msg_post'];
    
    
$t time();
    
$message str_replace("(date)",date($modSettings['telegram_dateformat'],$t),$message);
    
    
    
$request $smcFunc['db_query'](''"
                SELECT
                    mem.real_name, m.subject, b.name, m.id_topic, m.id_board  
                FROM {db_prefix}messages as m
                LEFT JOIN {db_prefix}members as mem ON (m.id_member = mem.id_member) 
                LEFT JOIN {db_prefix}boards as b ON (b.id_board = m.id_board) 
                WHERE m.id_msg = 
$messageid");
    
$row $smcFunc['db_fetch_assoc']($request);
    
$username $row['real_name'];
    
    if (empty(
$row['real_name']))
    {
        
// Load the language files
        
if (loadlanguage('telegram') == false)
            
loadLanguage('telegram','english');
            
        
$username $txt['telegram_guest'];
    }    
        
    
$message str_replace("(username)",$username,$message);
    
$message str_replace("(title)",$row['subject'],$message);
    
$message str_replace("(board)",$row['name'],$message);
    
$message str_replace("(url)",$scripturl '?topic=' $row['id_topic'] . '.msg' $messageid '#msg' $messageid,$message);
    
$message str_replace("(can_url)",$scripturl '?topic=' $row['id_topic'] . '.0',$message); // this one allows canonical url...
    
$message html_entity_decode($messageENT_QUOTES ENT_XML1'UTF-8');

    
// Check if this is in a board that is allowed to post
    
$boardlist explode(",",$modSettings['telegram_boardstopush']);
    
$boardlist explode(",",$modSettings['telegram_boardstopush2']);
    if (!
in_array($row['id_board'],$boardlist))
        return;    

    
telegram_send($message);
    
    
}

function 
telegram_send_new_member_registration($memberID)
{
    global 
$modSettings$smcFunc;
    
    if (empty(
$modSettings['telegram_enable_push_registration']))
        return;


    if (empty(
$memberID))
        return;        
        
    
$message $modSettings['telegram_msg_reg'];
    
    
$t time();
    
$message str_replace("(date)",date($modSettings['telegram_dateformat'],$t),$message);
    
    
// lookup member id
    
$request $smcFunc['db_query'](''"
                SELECT
                    real_name
                FROM {db_prefix}members
                WHERE id_member = 
$memberID");
    
$row $smcFunc['db_fetch_assoc']($request);
    
$username $row['real_name'];
    
    
    
$message str_replace("(username)",$username,$message);
    
$message html_entity_decode($messageENT_QUOTES ENT_XML1'UTF-8');


    
    
telegram_send($message);
    
}

?>

telegram2.template.php

<?php
/*
Telegram Autopost
Version 1.0
by:vbgamer45
https://www.smfhacks.com

License Information:
Links to https://www.smfhacks.com must remain unless
branding free option is purchased.
*/

function template_telegram_settings()
{
    global 
$context$txt$scripturl$boarddir$modSettings;

    echo 
'
 <div class="cat_bar">
        <h3 class="catbg centertext">
        '
$txt['telegram_admin'] , '
        </h3>
  </div>
    <form method="post" name="frmsettings" id="frmsettings" action="'
$scripturl'?action=admin;area=telegram;sa=settings2" accept-charset="'$context['character_set'], '">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
        <td width="50%" colspan="2"  align="center" class="windowbg2"><strong>' 
$txt['telegram_txt_settings'] . '</strong>
        </td>
        </tr>

            <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_bot_auth_token'] .'</td>
            <td class="windowbg2"><input type="text" size="50" name="telegram_enable_bot_auth_token" value="' 
$modSettings['telegram_enable_bot_auth_token2'] . '" />
            <br /><span class="smalltext">' 
.$txt['telegram_enable_bot_auth_token_desc'] . '</span>
            </td>
        </tr>    
        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_chat_id'] .' </td>
            <td class="windowbg2"><input type="text" name="telegram_enable_chat_id" value="' 
$modSettings['telegram_enable_chat_id2'] . '" />
            <br /><span class="smalltext">' 
.$txt['telegram_enable_chat_id_desc'] . '</span>
            </td>
        </tr>  
        
          <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_bot_auth_token'] .'</td>
            <td class="windowbg2"><input type="text" size="50" name="telegram_enable_bot_auth_token" value="' 
$modSettings['telegram_enable_bot_auth_token'] . '" />
            <br /><span class="smalltext">' 
.$txt['telegram_enable_bot_auth_token_desc'] . '</span>
            </td>
        </tr>    
        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_chat_id'] .' </td>
            <td class="windowbg2"><input type="text" name="telegram_enable_chat_id" value="' 
$modSettings['telegram_enable_chat_id'] . '" />
            <br /><span class="smalltext">' 
.$txt['telegram_enable_chat_id_desc'] . '</span>
            </td>
        </tr>  
        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_dateformat'] .'</td>
            <td class="windowbg2"><input type="text" size="50" name="telegram_dateformat" value="' 
$modSettings['telegram_dateformat'] . '" />
            <br /><span class="smalltext">' 
.$txt['telegram_dateformat_desc'] . '</span>
            </td>
        </tr>
        

        <tr class="windowbg2">
        <td valign="top" align="right">' 
$txt['telegram_boardstopush'] . ' </td>
        <td valign="top">'
;
    
$boardList explode(",",$modSettings['telegram_boardstopush']);
    
    echo 
'<select name="telegram_boardstopush[]" multiple="multiple" size="10">';

                        foreach (
$context['telegram_boards'] as $key => $option)
                        {
                            if (!
in_array($key,$boardList))
                            echo 
'<option value="' $key '">' $option '</option>';
                            else 
                                echo 
'<option selected="selected" value="' $key '">' $option '</option>';
                            
                        }
                        
                        echo 
'
                        <tr class="windowbg2">
        <td valign="top" align="right">' 
$txt['telegram_boardstopush'] . ' </td>
        <td valign="top">'
;
                        
$boardList explode(",",$modSettings['telegram_boardstopush2']);
    
    echo 
'<select name="telegram_boardstopush2[]" multiple="multiple" size="10">';

                        foreach (
$context['telegram_boards'] as $key => $option)
                        {
                            if (!
in_array($key,$boardList))
                            echo 
'<option value="' $key '">' $option '</option>';
                            else 
                                echo 
'<option selected="selected" value="' $key '">' $option '</option>';
                            
                        }
                    
                    echo 
'</select>';
        
    echo 
'    
        <br />
            <span class="smalltext">' 
.$txt['telegram_boardstopush_desc'] . '</span>
            </td>
        </tr>
        

        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_push_registration'] .' </td>
            <td class="windowbg2"><input type="checkbox" name="telegram_enable_push_registration"' 
. (!empty($modSettings['telegram_enable_push_registration']) ? ' checked="checked"' '') . ' />
            </td>
        </tr>  
  
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_msg_reg'] .' </td>
            <td class="windowbg2"><textarea name="telegram_msg_reg" rows="5" cols="50">' 
$modSettings['telegram_msg_reg'] . '</textarea>
            </td>
        </tr>  
        
        
        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_push_topic'] .' </td>
            <td class="windowbg2"><input type="checkbox" name="telegram_enable_push_topic"' 
. (!empty($modSettings['telegram_enable_push_topic']) ? ' checked="checked"' '') . ' />
            </td>
        </tr>  

        
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_msg_topic'] .' </td>
            <td class="windowbg2"><textarea name="telegram_msg_topic" rows="5" cols="50">' 
$modSettings['telegram_msg_topic'] . '</textarea>
            </td>
        </tr>  
        

        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_enable_push_post'] .' </td>
            <td class="windowbg2"><input type="checkbox" name="telegram_enable_push_post"' 
. (!empty($modSettings['telegram_enable_push_post']) ? ' checked="checked"' '') . ' />
            </td>
        </tr>  

  
        <tr>
            <td class="windowbg2" align="right" valign="top">' 
$txt['telegram_msg_post'] .' </td>
            <td class="windowbg2"><textarea name="telegram_msg_post" rows="5" cols="50">' 
$modSettings['telegram_msg_post'] . '</textarea>
            </td>
        </tr>          

      <tr>
        <td colspan="2" class="windowbg2" align="center">
        <input type="hidden" name="sc" value="'
$context['session_id'], '" />
        <input type="submit" name="cmdsave" value="'
,$txt['telegram_txt_savesettings'],'" /></td>
      </tr>

      
      </table>
      </form>



  '
;

}




?>

gear777

Hello, I'm trying to make the posts publish automatically on my Telegram channel, but I can't get the bot to publish them. I have the chat id and the bot token, but the posts only appear in the bot and not in the channel. The bot is admin on the telegram channel. Can somebody help me?

I am using this mod -> https://custom.simplemachines.org/index.php?mod=4254

Thanks.

Advertisement: