Page 2 of 4

Re: [3.2][BETA] Telegram Notifications

Posted: Fri Aug 04, 2017 12:43 pm
by lassik
potku wrote: Thu Aug 03, 2017 10:50 am I should be at a point where that ID is the only thing missing. Is it the one with a negative sign in front of it (I read that for groups it's like that)?
Exactly :) Group IDs all seem to be negative numbers whereas individual user IDs (for one-to-one chat) are positive numbers.
potku wrote: Thu Aug 03, 2017 10:50 am the bot is not delivering messages to the group.
It sounds like you got the right chat ID for your group. And since you were able to see the ACP Telegram IDs panel and type in the chat ID, you must have unzipped the extension into the right folder and got it enabled.

Unfortunately the ext doesn't have any logging right now so it's hard to say what the problem is :(

One thing is that if PHP's cURL support is not enabled, it will not send any messages (since the whole thing is basically coded using cURL). But I can't find a way to check that from the phpBB UI.

You could also try using the Chat ID of your personal Telegram account instead of a group chat. That way the bot will try to send private messages to you instead of sending them to the group. Personal chat IDs are positive numbers, here's one way to find out yours: https://stackoverflow.com/a/32777943

It would be good to add better diagnostics/logging to the extension anyway, but unfortunately I can't personally devote a lot of time to developing this ext, so updates will take some time.

EDIT: One more thing - Telegram bot auth tokens look like this: a bunch of decimal digits, then a colon (a ":" mark), then a random-looking mix of small and capital letters as well as digits. Did you remember to include both the part before the colon and the part after?

Re: [3.2][BETA] Telegram Notifications

Posted: Tue Aug 15, 2017 9:47 am
by lassik
Just released a new version 0.2.0. The download link in the first post now points to this version.

This version adds a 'Last error' display to the extension's ACP panel. Each time someone has posted, the extension records the outcome of sending the Telegram notification here. Normally it says 'Success'. If there was an error, the error message ought to be shown here.

@potku Since the ext didn't work for you, can you try installing this version and see what error message you get?

I'm still not parsing detailed error messages from the Telegram API but we can add that too if needed.

Re: [3.2][BETA] Telegram Notifications

Posted: Tue Aug 15, 2017 11:01 am
by lassik
Just released a new version 0.3.0. The download link in the first post now points to this version.

Felt inspired so added the code right away to parse more detailed error messages from the Telegram API. Now they're pretty much as detailed as they can be.

Re: [3.2][BETA] Telegram Notifications

Posted: Sun Sep 24, 2017 7:21 am
by Gubkin
I can't remove data in ACP after turn off extension


have the error

Code: Select all

Fatal error: Uncaught phpbb\module\exception\module_exception: CANNOT_REMOVE_MODULE in /home/oilchoice/oilchoice.ru/docs/phpbb/module/module_manager.php:448 Stack trace: #0 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migration/tool/module.php(371): phpbb\module\module_manager->delete_module(465, 'acp') #1 [internal function]: phpbb\db\migration\tool\module->remove('acp', 32, 'ACP_TELEGRAM_NO...') #2 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migration/tool/module.php(405): call_user_func_array(Array, Array) #3 [internal function]: phpbb\db\migration\tool\module->reverse('add', 'acp', 'ACP_CAT_DOT_MOD...', 'ACP_TELEGRAM_NO...') #4 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migrator.php(711): call_user_func_array(Array, Array) #5 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migrator.php(658): phpbb\db\migrator->run_step(Array, NULL, false) #6 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migrator.php(551): phpbb\db\migrator->process_data_step(Array, Array) #7 /home/oilchoice/oilchoice.ru/docs/phpbb/db/migrator.php(514): phpbb\db\ in /home/oilchoice/oilchoice.ru/docs/phpbb/module/module_manager.php on line 448
have this on ver 0.3.0 and new 0.4.0

Re: [3.2][BETA] Telegram Notifications

Posted: Sun Sep 24, 2017 9:12 am
by Orcajavi
Great extension.
It would be nice to be able to choose which forums can be blocked to not receive notifications from them.

Re: [3.2][BETA] Telegram Notifications

Posted: Fri Oct 06, 2017 3:31 pm
by $ina
how to send topic Issue with pictures ?
this is only posted topic_title
thanx

Re: [3.2][BETA] Telegram Notifications

Posted: Wed Oct 11, 2017 9:36 pm
by lassik
Gubkin wrote: Sun Sep 24, 2017 7:21 am I can't remove data in ACP after turn off extension

have this on ver 0.3.0 and new 0.4.0
Sorry to hear that you are having problems with it. Unfortunately, there seems to be some problem with the ACP migration code in 0.4.0 (from GitHub). That's why I removed the link to 0.4.0 from this forum and the download link in the first post in this thread still points to the old 0.3.0.

The issue in 0.4.0 is that it changes an ACP module by first removing it, then re-adding a changed version of it. (The purpose is to add a new page to the ACP.) This seems to confuse phpBB, in particular if you upgrade from 0.3.0 to 0.4.0 without disabling the ext in between :-( If someone wants to take a look at the migration code and spot what's wrong, it's here: https://github.com/lassik/phpbb-ext-tel ... _0_4_0.php I'm a little out of my depth here.
Orcajavi wrote: Sun Sep 24, 2017 9:12 am Great extension.
Thanks, it's nice to see that somebody else is also finding it useful :-)
Orcajavi wrote: Sun Sep 24, 2017 9:12 am It would be nice to be able to choose which forums can be blocked to not receive notifications from them.
That would be quite a big change to the ACP panel. I don't personally have time to do it but if somebody is experienced with ext coding and wants to add this, feel free to take a stab at it :-)
$ina wrote: Fri Oct 06, 2017 3:31 pm how to send topic Issue with pictures ?
this is only posted topic_title
That's true, I started as simply as possible. Do you mean the small picture (icon) next to the topic? Again I don't have time to add this but if somebody wants try, feel free :)

More generally, if somebody wants to help improve/maintain the code, help is welcome :)

Re: [3.2][BETA] Telegram Notifications

Posted: Thu Oct 12, 2017 5:33 am
by Paul
You probably should make it two separate migrations, and define the correct depends on values

Re: [3.2][BETA] Telegram Notifications

Posted: Sat Nov 18, 2017 7:13 pm
by demonlibra
it would be great if the notice contained part of the message text.

Re: [3.2][BETA] Telegram Notifications

Posted: Mon Nov 20, 2017 1:04 pm
by lassik
Thanks for the interest.
demonlibra wrote: Sat Nov 18, 2017 7:13 pm it would be great if the notice contained part of the message text.
This should be easy to do. I'll try to add an ACP checkbox in the next version.
ZaneMcK wrote: Sat Nov 18, 2017 3:05 pm Can I specifify (in my UCP, or maybe generally in the ACP for certain groups) which notifications should go to Telegram? I.e. only newly registered user activations, not for every subscribed topic.
It should be easy to add some checkboxes to the ACP to select which notifications to send. I'll try to add it in the next version.

I don't know anything about UCP coding, probably won't have time to investigate this myself.
ZaneMcK wrote: Sat Nov 18, 2017 3:05 pm It would be even better if I could set it to send reported posts to Telegram, is that possible with your extension?
Do you mean that the Telegram notification should contain the message body in addition to the topic title (as demonlibra asked)? Or do you mean that there should be a button in phpBB next to each message so moderators could manually send a notification to Telegram about that message?

Re: [3.2][BETA] Telegram Notifications

Posted: Mon Nov 27, 2017 7:39 pm
by donsenilo
Hi

yes, I'm very confused about the "function" of this ext.

What I think (and hope) is, that with this ext it's possible to automatically send postings (made in my forum) to a specific telegram-account.
I've created a channel in telegram (called "Paranormal.wien") and added a bot called "paranormalwienbot").
In ACP at "Telegram bot auth token" I've added a very long mixed string and in "Telegram chat ID" the "paranormalwienbot".
But I'm not sure, if this is correct.

Sorry if this is stupid :-(

Please help.

Re: [3.2][BETA] Telegram Notifications

Posted: Wed Nov 29, 2017 7:33 pm
by lassik
donsenilo wrote: Mon Nov 27, 2017 7:39 pm What I think (and hope) is, that with this ext it's possible to automatically send postings (made in my forum) to a specific telegram-account.
ZaneMcK wrote: Sat Nov 25, 2017 1:56 pm
lassik wrote: Mon Nov 20, 2017 1:04 pm
ZaneMcK wrote: Sat Nov 18, 2017 3:05 pm It would be even better if I could set it to send reported posts to Telegram, is that possible with your extension?
Do you mean that the Telegram notification should contain the message body in addition to the topic title (as demonlibra asked)? Or do you mean that there should be a button in phpBB next to each message so moderators could manually send a notification to Telegram about that message?
Preferably it would contain the same information as the report has: Topic title (link), reporter, reason, and yes, message body.
But, if that's too complicated, a message with just a link to the report will suffice.
Ok, now I see what you mean. The ext does exactly what you are asking for. The forum will automatically send a link to every new post to a Telegram group. The current version only sends the title of the topic. In the next version I will try to add an option to send some of the text from the beginning of the post too.
donsenilo wrote: Mon Nov 27, 2017 7:39 pmI've created a channel in telegram (called "Paranormal.wien") and added a bot called "paranormalwienbot").
In ACP at "Telegram bot auth token" I've added a very long mixed string and in "Telegram chat ID" the "paranormalwienbot".
You seem to have almost everything correct :) Only "Telegram chat ID" should be a negative number, for example -1234567, instead of the name of the chat. Please see https://stackoverflow.com/a/32572159 for how to find the number. The next version will try to find the number for you automatically, but it will take some time to be released.

Re: [3.2][BETA] Telegram Notifications

Posted: Thu Nov 30, 2017 3:10 pm
by donsenilo
Thanks lassik

I think now I've the correct chat ID. But in my case it's not a negative number.

UPDATE:
It works !!! :-)
But I get the topic title instead of the post title.

And btw.: Is it possible to forward only new postings ? Because at this time every (!) change is forwarded to telegram.

Re: [3.2][BETA] Telegram Notifications

Posted: Sun Dec 03, 2017 12:26 pm
by lassik
Good to hear that you got it to work!
donsenilo wrote: Thu Nov 30, 2017 3:10 pm I get the topic title instead of the post title.
This is intentional. I personally think the phpBB feature to give post titles that are different from the topic title is confusing and too much detail. I don't know what the consensus among phpBB users is. We could change the ext to use the post title instead (in most cases it's the same after all). Or we could add a choice to the ACP.
donsenilo wrote: Thu Nov 30, 2017 3:10 pm And btw.: Is it possible to forward only new postings ? Because at this time every (!) change is forwarded to telegram.
Yes, the current version notifies about all edits to old posts. We are also starting to think this is too much detail for us. In the next version I'll change it so that notifications about edits are only sent when "Reason for editing this post" is given. So if the reason is left blank (as it usually is) then no notification will be sent to Telegram. Would this solve your problem well enough?

Re: [3.2][BETA] Telegram Notifications

Posted: Fri Dec 22, 2017 2:56 pm
by lord_wolken
Hey lassik, great extension! Thank you!!!

I added a small text preview to the telegram message changing the line 54 of main_listener.php as follows (if anybody might find it helpful):

Code: Select all

$preview = htmlspecialchars(strip_tags(substr($event['data']['message'],0,256)));
if (strlen($event['data']['message']) > 256){
	$preview = $preview.' [...]';
}
$html = '['.htmlspecialchars($event['username']).'] '.
	htmlspecialchars($this->prefix_from_mode($event['mode'])).
	 '<a href="'.htmlspecialchars($url).'">'.
	 $event['data']['topic_title'].
	'</a>'.
	'\r\n'.$preview;
Do you know if it would be possible to include as well an attached image? or link to attached files?