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
(https://i.ibb.co/6DqmQJ5/telegram.png)

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.

photo_0.jpg

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

photo_1.jpg

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).

photo_3.jpg

Step 5. Telegram chat ID.

Write in the search @get_id_bot and choose this bot.

photo_4.jpg

Click Start.

photo_5.jpg

Copy the chat ID.

photo_6.jpg