Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on April 11, 2020, 05:57:59 AM

Title: Telegram Autopost Bot
Post by: vbgamer45 on April 11, 2020, 05:57:59 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4254)

Adds support for posting of new topics and messages to Telegram
Also supports posting when a new user registers.

You can customize the messages posted for these actions

Uses either cURL or fsockopen to make the post.
Title: Re: Telegram Autopost Bot
Post by: -Rock Lee- on April 11, 2020, 02:42:35 PM
I was testing it and it is good, I also have a somewhat more worked bot that complements well with what I already had. Thanks for sharing :D!


Regards!
Title: Re: Telegram Autopost Bot
Post by: Massl on April 12, 2020, 03:35:16 AM
Very useful, thanks vbgamer45  :)
Title: Re: Telegram Autopost Bot
Post by: Dhayzon on April 12, 2020, 04:52:00 PM
Me ganó xD jajaja  yo llo iba  a publicar

pero tengan cuidado te pueden  eliminar  la cuenta no estoy seguro
pero cuando empece a utilizarlo mi cuenta de telegram fue eliminda ojo, el mod que yo había  desarrollado


en cuando a este mod úsenlo es muy bueno  para verificar la actividad de tu foro  a mi me servia  para controlar el spam
Title: Re: Telegram Autopost Bot
Post by: 4Kstore on April 12, 2020, 05:06:51 PM
Nice job man, thanks for sharing!
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 16, 2020, 03:04:33 PM

hi I installed this mod


https://custom.simplemachines.org/mods/index.php?mod=4254

for the automatic bot but I can't configure it how to set the chat id and the token I can't understand the guide, does anyone know how to do it?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 16, 2020, 03:09:03 PM
Did you create the bot yet?  You have to message the BotFather on telegram
Then do /newbot

That will give you the token

The chatID you can get via taking to the getid bot with /start that will reply back with your chat id.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 16, 2020, 03:17:46 PM
ok he gave me the token code but I did not understand the ideal of the chat where I take it
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 16, 2020, 03:22:51 PM
Chat id is the room/channel you want to use I believe.
Another way to find it check out https://docs.influxdata.com/kapacitor/v1.5/event_handlers/telegram/  the get telegram chat id page section
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 16, 2020, 03:26:04 PM
my token is format this:
numer:letterAndNumer

can't understand where to find the chatid
and how to set it up in the smf mod

I go to my newly created bot and put /start ? because it doesn't give me anything
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 16, 2020, 03:33:06 PM
token is good you just need the chat id number.
Check my post above on how to find it.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 16, 2020, 03:35:55 PM
i have contact this myidbot
but you say me is i not a bot because i write my account no bot
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 16, 2020, 03:47:00 PM
ok solved with my id
thanks man ;)
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 16, 2020, 03:50:05 PM
Glad you have it working!
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 06:25:59 AM
I 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!

Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 07:38:33 AM
Quote from: goldenstudios on April 17, 2020, 06:25:59 AM
I 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!

in the end I solved it :)
but I wanted to ask and is it possible for the mod to also insert a preview image of the links it sends? when do you create a post? maybe attached
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 09:55:11 AM
Yes I think it is possible there is a setting you can pass with the API but i i did not build it into the mod.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 09:59:07 AM

can you tell me how to do it? so I try and if it works it can be implemented
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 10:09:49 AM
Open sources/telegram2.php
Find

'disable_web_page_preview' => 'true',

Change to

'disable_web_page_preview' => 'false',
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 10:11:27 AM
set false and when i add attachment in telegram show img?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 10:12:00 AM
Not sure give it a try.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 10:13:00 AM
ok i try now...
but this bot not set "bold" text right?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 10:17:50 AM
It just posts the topic titles so not sure what would be bold?
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 10:23:27 AM

the BOLD does not mark it on telegram,
however I tried the change you said but it doesn't work
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 10:25:45 AM
Try changing the parse_mode field to  Markdown

And see if that helps with the bold
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 10:27:24 AM
Quote from: vbgamer45 on April 17, 2020, 10:25:45 AM
Try changing the parse_mode field to  Markdown

And see if that helps with the bold
where man?
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 10:37:52 AM
            $push = array(
'chat_id' => $modSettings['telegram_enable_chat_id'],
'disable_web_page_preview' => 'false',
'parse_mode' => 'HTML',
'text' => $message,
);


i set false but not work the img..
and the BOLD test same... show this
<b>test</b>
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on April 17, 2020, 11:00:28 AM
No idea then... try text
and use MarkDown as parse_mode
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 11:01:23 AM
Quote from: vbgamer45 on April 17, 2020, 11:00:28 AM
No idea then... try text
and use MarkDown as parse_mode
not work...same img
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on April 17, 2020, 11:05:12 AM

per hour the only way to get the image sent is to load the url into the message sent to the telegram bot
therefore the code of the mod
because it would take a query first to take the url of the attached img
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 05:34:58 AM
Doesn't work with SSL from cloudflare.com
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 09:46:21 AM
The posting? It shouldn't matter on that.
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 11:37:49 AM
I used cloudflare.com for https SSL and Telegram Autopost Bot stopped working.
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 11:53:24 AM
That should have zero impact. since this software runs server side. Check your forum error logs.
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 12:00:34 PM
2: strlen() expects parameter 1 to be string, array given
     index.php?board=135;action=post2
     Sources/telegram2.php (Line 177)
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 12:03:45 PM
2: strlen() expects parameter 1 to be string, array given
     index.php?action=signup2
     Sources/telegram2.php (Line 177)
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 12:11:11 PM
Copy this to your sources folder and let me know if this change helped.
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 12:29:56 PM
No. And a very long time server response.
No new errors in the forum logs.
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 12:31:40 PM
No messages in the telegram.
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 01:00:40 PM
What happens is the mod trys to use cURL if not installed.
Last attempt is to try fsockopen.

Will see if I can do another way
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 01:13:41 PM
Maybe cloudflare.com has some settings for the mod to start working?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 01:46:11 PM
No it would not.

Try this one. Added support for SMF's fetch remote file function
Title: Re: Telegram Autopost Bot
Post by: kpm21 on May 05, 2020, 02:54:14 PM
Works. Thank you!
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 03:11:59 PM
Glad to help! Will push the update
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 05, 2020, 04:14:56 PM
1.0.1
!Improvements to handle hosts without cURL uses SMF's fetch web data function before fsockopen

1.0 Initial Release
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on May 21, 2020, 09:49:24 AM
question, is it possible to add the image to the post on telegram? using the "send photo" function and attaching the photo with the description? and add the "bold" character is possible?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 21, 2020, 09:54:45 AM
It might be. But I haven't' done much with Telegram other than create this quick autopost.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on May 21, 2020, 09:56:42 AM

this mod is very useful, but you should customize it to make it to the top, can you see if you can integrate these functions?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on May 21, 2020, 10:48:02 AM
Maybe one day but busy at the moment so not likely.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on June 10, 2020, 04:42:42 PM
news man? for bold text?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on June 10, 2020, 08:52:22 PM
Nothing. Not working on the mod at this time.
Title: Re: Telegram Autopost Bot
Post by: goldenstudios on October 20, 2020, 07:36:37 PM
Quote from: vbgamer45 on June 10, 2020, 08:52:22 PM
Nothing. Not working on the mod at this time.
i see you post new version of telegram bot?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2020, 08:59:34 PM
No just marked for RC3
Title: Re: Telegram Autopost Bot
Post by: Snrj on January 14, 2021, 07:48:58 AM
turkish translate


modu türkçeleştirme sitenizin dil yapısına göre telegram.turkish-utf8.php veya telegram.turkish.php adında dosya oluşturun içine Alttaki kodları yapıştırıp Themes\default\languages klasörüne atın
<?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.
*/

$txt['telegram_txt_settings'] = 'Ayarlar';
$txt['telegram_txt_settings_desc'] = 'Telegram Ayarları için ayarlar ve seçenekler';
$txt['telegram_txt_savesettings'] = 'Ayarları Kaydet';
$txt['telegram_admin'] = 'Telegram Botu Otomatik Yayın Ayarları';


$txt['telegram_enable_bot_auth_token'] = 'Telegram Bot Token';
$txt['telegram_enable_bot_auth_token_desc'] = 'Bot Token Nasıl Alınır: <a href="https://core.telegram.org/bots/api#authorizing-your-bot" target="_blank">https://core.telegram.org/bots/api#authorizing-your-bot</a>';
$txt['telegram_enable_chat_id'] = 'Telegram Chat ID';
$txt['telegram_enable_chat_id_desc'] = 'Chat ID Nasıl Alınır: <a href="https://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user" target="_blank">https://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user</a>';


$txt['telegram_guest'] = 'Ziyaretçi';


$txt['telegram_enable_push_registration'] = 'Anlık Kayıt Bildirimlerini Etkinleştir';
$txt['telegram_enable_push_topic'] = 'Anlık Konu Bildirimlerini Etkinleştir';
$txt['telegram_enable_push_post'] = 'Anlık Cevap Bildirimlerini Etkinleştir';
$txt['telegram_boardstopush'] = 'Konu / Cevap Bildirimleri için Bölümler';
$txt['telegram_boardstopush_desc'] = 'İstediğiniz Bölümleri seçmek için shift veya ctrl basılı tutun';
$txt['telegram_dateformat'] = 'Tarih Biçimi';
$txt['telegram_dateformat_desc'] = 'Tarih Biçimleri hakkında daha fazla bilgiye burdan <a href="http://php.net/manual/en/function.date.php" target="_blank">http://php.net/manual/en/function.date.php</a>';
$txt['telegram_msg_reg'] = 'Anlık Kayıt Mesajı';
$txt['telegram_msg_topic'] = 'Anlık Konu Mesajı';
$txt['telegram_msg_post'] = 'Anlık Cevap Mesajı';
$txt['telegram_botname_reg'] = 'Kayıt için Botname';
$txt['telegram_botname_topic'] = 'Konular için Botname';
$txt['telegram_botname_post'] = 'Cevaplar için Botname';


?>


Modifications.turkish-utf8.php veya Modifications.turkish.php ekleyin
$txt['telegram_admin'] = 'Telegram Ayarları';

mod ayar sayfasından mesajları şu şekil düzeltebilirisiniz
yeni kayıt
Yeni Kullanıcı - **(username)** - Kayıt Oldu **(date)**
yeni konu
@(username) Yeni Konu Başlattı *(title)* - (url) Şu Bölümde *(board)*
yeni cevap
@(username) Yeni Mesaj Yazdı *(title)* - (url) Şu Bölümde *(board)*
Title: Re: Telegram Autopost Bot
Post by: Matthias on February 17, 2021, 12:06:17 PM
Very nice Mod!  ;)

Is it also possible that the actual message is included, not just the subject.
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on February 17, 2021, 12:17:15 PM
Would have been changed to do so but could be possible. pass the body instead of subject.
Title: Re: Telegram Autopost Bot
Post by: Matthias on March 05, 2021, 03:45:03 PM
Maybe, there is a little issue at that mod.

It works only for Boards and Topics with utf8 conform characters. If there is a non utf8 character, it doesn't work.

Error log:
Bad Request: strings must be encoded in UTF-8
400:{"ok":false,"error_code":400,"description":"Bad Request: strings must be encoded in UTF-8"}
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on March 05, 2021, 04:27:55 PM
What's an example of a non utf8 character? like an emoji?
Title: Re: Telegram Autopost Bot
Post by: Matthias on March 05, 2021, 04:38:46 PM
Didn't test it with emojis.

But with non utf8 characters like ö- ü - ä
For other languages it's maybe the same ...
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on March 05, 2021, 04:46:13 PM
Hmm i wonder if utf8_encode before sending it to telegram will help
Title: Re: Telegram Autopost Bot
Post by: Matthias on March 05, 2021, 05:12:23 PM
Maybe or not.
Thinking about the telegram bot API...
I had though of it and got some result for my own, it changes from time to time.
https://core.telegram.org/bots/api



Title: Re: Telegram Autopost Bot
Post by: kesulin on March 12, 2021, 04:12:27 AM
this mod not allow bold text? any solutions about it?

Forget it, I find the solution.

-Open telegram2.php
-Find function "telegram_sendCURL($message)"
Change:
curl_setopt($ch, CURLOPT_URL,  'https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token'].'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id'] . "&text=". urlencode($message['text']));

to

curl_setopt($ch, CURLOPT_URL,  'https://api.telegram.org/bot'.$modSettings['telegram_enable_bot_auth_token'].'/sendMessage?chat_id=' .$modSettings['telegram_enable_chat_id'] . "&text=". urlencode($message['text'])."&parse_mode=html");

now html tags works
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 19, 2021, 04:33:30 PM
Hello to all. I already setup all but not working what can be missing any help?
Title: Re: Telegram Autopost Bot
Post by: shadav on October 19, 2021, 04:39:17 PM
Quote from: mpcgferreira on October 19, 2021, 04:33:30 PMHello to all. I already setup all but not working what can be missing any help?
need a bit more info other than it's not working
how is it not working?
any errors?
what version of smf are you using?
any errors in your smf logs?
any errors in your server logs?
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 19, 2021, 04:46:26 PM
Quote from: shadav on October 19, 2021, 04:39:17 PM
Quote from: mpcgferreira on October 19, 2021, 04:33:30 PMHello to all. I already setup all but not working what can be missing any help?
need a bit more info other than it's not working
how is it not working?
any errors?
what version of smf are you using?
any errors in your smf logs?
any errors in your server logs?

Thanks for reply. I use SMF 2.0.18
I setup api token on the right place. Put the channel id but any changes made on the forum dont get any msg on the telegram.
The only error i get is these: "2: Parameter 1 to RIAST_Titles() expected to be a reference, value given"
On the server side dont have erros.

These mod need any cron?

Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 10:56:03 AM
Quote from: mpcgferreira on October 19, 2021, 04:46:26 PM
Quote from: shadav on October 19, 2021, 04:39:17 PM
Quote from: mpcgferreira on October 19, 2021, 04:33:30 PMHello to all. I already setup all but not working what can be missing any help?
need a bit more info other than it's not working
how is it not working?
any errors?
what version of smf are you using?
any errors in your smf logs?
any errors in your server logs?

Thanks for reply. I use SMF 2.0.18
I setup api token on the right place. Put the channel id but any changes made on the forum dont get any msg on the telegram.
The only error i get is these: "2: Parameter 1 to RIAST_Titles() expected to be a reference, value given"
On the server side dont have erros.

These mod need any cron?



About these problem solved "2: Parameter 1 to RIAST_Titles() expected to be a reference, value given"
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 11:03:22 AM
RIAST_Title is not part of this mod.

This mod does like cURL to be enabled in order to post. You can see if it is by checking your phpinfo page.
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 11:17:45 AM
Quote from: vbgamer45 on October 20, 2021, 11:03:22 AMRIAST_Title is not part of this mod.

This mod does like cURL to be enabled in order to post. You can see if it is by checking your phpinfo page.

Hello thanks for the reply,
Just check and curl is enable for the php version.

I have php 7.4
0 errors on the log

---

One question on the telegram bot token the code is similar to these;

Telegram Bot Token -> 2072778772:AAFqwoJRy5LIgThTsddt7fLQobWYYvwOHJY

And on the channel id the code is similar to these:

Telegram Chat ID -> 1001666685967

Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 11:24:20 AM


My setup
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 11:27:32 AM
My bot token looks similar.
And chat id looks like that
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 11:32:34 AM
Quote from: vbgamer45 on October 20, 2021, 11:27:32 AMMy bot token looks similar.
And chat id looks like that

Hello thanks for the reply. Any idea why my don´t work  if setup is good?

I get my chat id from MissRoseBot
I get my token for the bot from BotFather
I add the boot to the channel as admin

I am lost!?!?!
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 11:42:21 AM
Just try something. Create a reply to a topic and check for errors and get 2

First

"JSON Syntax error"

Second

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>

---

If we search on google for these error we get "The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)."

---

The MOD have any problem with SMF 2.0.18? or any of these MOD have impact the telegram MOD
Google Analytics Code
Optimus for SMF
SEO Sitemap   
RSS Feed Poster   
Pretty URLs   
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 11:51:23 AM
Test with your own url replace the options in the url with your settings
https://api.telegram.org/bot' . $modSettings['telegram_enable_bot_auth_token'] . '/sendMessage?chat_id=' . $modSettings['telegram_enable_chat_id'] . "&text=" . urlencode($message['text']
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 12:05:08 PM
Quote from: vbgamer45 on October 20, 2021, 11:51:23 AMTest with your own url replace the options in the url with your settings
https://api.telegram.org/bot' . $modSettings['telegram_enable_bot_auth_token'] . '/sendMessage?chat_id=' . $modSettings['telegram_enable_chat_id'] . "&text=" . urlencode($message['text']

I put that on browser url and get these: {"ok":false,"error_code":404,"description":"Not Found"}
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 12:51:15 PM
hmm i didn't get a 404

https://api.telegram.org/botREPLACEBOTIDHERE/sendMessage?chat_id=REPLACECHATIDHERE&text=test
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 01:19:21 PM
Hello,
Now i get these {"ok":false,"error_code":400,"description":"Bad Request: chat not found"}

chat no found is strange because i get the ID from MissRoseBot
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 01:47:33 PM
Chat ID is tricky to get. It has been a long time though i don't remember exactly.

From searching
You have to add the bot to be an administrator of the channel before it can send messages to the channel.
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 02:01:24 PM
Quote from: vbgamer45 on October 20, 2021, 01:47:33 PMChat ID is tricky to get. It has been a long time though i don't remember exactly.

From searching
You have to add the bot to be an administrator of the channel before it can send messages to the channel.

Yes i know that!
The ID i need is the Group or Channel ID correct?
or
The user bot user ID?
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on October 20, 2021, 02:15:48 PM
It 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.
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 02:22:04 PM
Thanks,
I try to find more info.

But i drop these link that can be usefull.

https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 02:32:28 PM
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
Edit the API Token and the Group-ID!
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 20, 2021, 02:46:06 PM
These code work to check if data provided on the setup are good

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

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 ???????
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on October 21, 2021, 08:28:14 AM
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
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"}}
Title: Re: Telegram Autopost Bot
Post by: wylekk on December 15, 2021, 09:27:12 AM
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?
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on December 16, 2021, 12:36:39 PM
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.
Title: Re: Telegram Autopost Bot
Post by: wylekk on December 17, 2021, 09:51:01 AM
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.
Title: Re: Telegram Autopost Bot
Post by: mpcgferreira on January 31, 2022, 12:22:26 PM
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
Title: Re: Telegram Autopost Bot
Post by: Will Garcia on February 27, 2022, 08:12:49 PM
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?
Title: Re: Telegram Autopost Bot
Post by: Pyrhel on April 13, 2022, 11:55:26 AM
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?
Title: Re: Telegram Autopost Bot
Post by: underc0de on February 20, 2023, 01:03:05 AM
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
Title: Re: Telegram Autopost Bot
Post by: Will Garcia on June 17, 2023, 08:23:16 AM
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
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on June 17, 2023, 10:17:54 AM
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.
Title: Re: Telegram Autopost Bot
Post by: Will Garcia on June 19, 2023, 06:27:41 AM
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
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on June 19, 2023, 09:11:09 AM
Don't have time currently to work on this.
Title: Re: Telegram Autopost Bot
Post by: 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)
Title: Re: Telegram Autopost Bot
Post by: Will Garcia on June 19, 2023, 12:55:47 PM
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
Title: Re: Telegram Autopost Bot
Post by: vbgamer45 on June 19, 2023, 12:56:23 PM
What file/edit did you change
Title: Re: Telegram Autopost Bot
Post by: Will Garcia on June 19, 2023, 01:40:30 PM
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>



  '
;

}




?>