Mirror to contribute to upstream. Telegram bridge to republish Gancio events https://framagit.org/bcn.convocala/gancio-plugin-telegram-bridge/
Go to file
Evilham dc0db05d07
Minor localisation and usability bugfixes
When the server's locale and/or timezone are different from that in
Gancio, weird things were happening.

While there, we make `renderEvent` a tad more modular so that
potentially new settings can be introduced in the future.

Introduced changes:

- `renderEventDateTime` uses both Gancio's locale and timezone, this
  has the effect that (in theory! please test) no matter the server's
  timezone, the message will be rendered according to Gancio's
  settings (which is, I'd argue, an admin's expectation)
- `renderEventTitle` generates a link to Gancio's event, which people
  can use to get more info
- I noticed while importing events that sometimes the `description`
  field could be prefilled with `null` as a string, while this might
  be a Gancio bug to fix, we can also skip those descriptions

New boolean configuration options:
- `skip_link_to_gancio`: it skips the final link to Gancio making the
  message slightly shorter
- `tags_link_to_gancio`: it affects `renderEventTags`, which by
  default allows Telegram to handle tags. When this option is applied,
  tags link instead to their Gancio site, which lists all related
  events on the instance
2023-05-31 20:57:25 +02:00
conf Minor localisation and usability bugfixes 2023-05-31 20:57:25 +02:00
data Add v0.1.0 screenshot 2022-07-04 18:25:53 +02:00
.gitignore First minimal working version! 2022-07-04 17:54:33 +02:00
LICENSE Add LICENSE 2022-07-04 15:57:54 +00:00
README.md update readme 2023-04-19 20:21:43 +02:00
index.js Minor localisation and usability bugfixes 2023-05-31 20:57:25 +02:00
package.json version 1.0.1 2023-05-10 18:33:06 +02:00

README.md

Telegram bridge for Gancio

This is an attempt to create a plugin for Gancio that republishes content to Telegram channels or groups. The goal is to spread the info of our networks to the capitalist cyberspace, and pull otherwise isolated people to our radical and free part of the internet.

Clone this repo to your Gancio

I don't know how to install this plugin side by side to other plugins. So let's do it like this by now:

# assuming docker installation as per https://gancio.org/install/docker
$ cd /opt/gancio/data
$ git clone https://framagit.org/bcn.convocala/gancio-plugin-telegram-bridge.git
$ mv gancio-plugin-telegram-bridge plugins
$ cd plugins/gancio-plugin-telegram-bridge 
$ npm i

Configuration

Once the plugin is installed, navigate to your instance plugins tab of the admin interface. Enable the plugin, and add the required data:

Try

  1. Restart your gancio instance and look at the logs for any message saying that this plugin has been loaded.
  2. Edit an existing event and save it just like that (this counts as an update)
  3. Check your telegram channel for new activities

Rough roadmap

v0.1.0

  • Send plain text messages with event info
  • Send photos with event info

v1.0.0

  • Test plugin with public instance. Event URLs from dev env are unreachable for telegram to retrieve info.
  • Check for Telegram API limits: image size, description text lenght
  • Ensure gancio event description text is cleaned for limited html telegram support (like <p> and <h1>)
  • Ignore update and delete by now.

More

  • Register created or modified events to an sqlite db
  • Use telegram edit feature to modify sent events
  • Use telegram delete feature to remove deleted events
  • Register commands to edit config, and to add and remove bot admin telegram accounts
  • Fill properly npm package.json
  • Add tests
  • Allow to send to multiple channels
  • Allow to send from multiple bots