|
il y a 4 ans | |
---|---|---|
.. | ||
LICENSE | il y a 4 ans | |
README.md | il y a 4 ans | |
channel.js | il y a 4 ans | |
council.js | il y a 4 ans | |
forum.js | il y a 4 ans | |
package.json | il y a 4 ans | |
proposal.js | il y a 4 ans |
Many thanks to imOnlineMonitor for providing example with polkadot chain (Kusama).\ This script will notify several events on Joystream chain to Telegram group/channel/chat of your choice.\ Current demo is https://t.me/jsforumnotification
Joystream Node\ Yarn and Nodejs
git clone https://github.com/bitoven-dev/joystreamtelegrambot
cd joystreamtelegrambot
yarn install
Replace yourowntoken
on const token = 'yourtoken';
with your Telgram bot token. You can get it by talking to @botfather
Replace yourownchat
on const chatid = 'yourchatid';
with your group/channel the bot will notify into. Bot needs to be added as admin, but it only needs to post message permission. How to get chatid
1- Add the bot to the group.
Go to the group, click on group name, click on Add members, in the searchbox search for your bot like this: @my_bot, select your bot and click add.
2- Send a dummy message to the bot.
You can use this example: /my_id @my_bot
(I tried a few messages, not all the messages work. The example above works fine. Maybe the message should start with /)
3- Go to following url: https://api.telegram.org/botXXX:YYYY/getUpdates
replace XXX:YYYY with your bot token
4- Look for "chat":{"id":-zzzzzzzzzz,
-zzzzzzzzzz is your chat id (with the negative sign).
Run node yourchoiceofscript.js
preferably inside screen/tmux window or systemd
I've just started to learn programming (JS), so any suggestions or PR is greatly appreciated 😁