Skip to content

Telegram bot to query UOS Network Social and Importance° rates

License

Notifications You must be signed in to change notification settings

UOSnetwork/uos.score.bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UOS Score Bot for Telegram

Build Status GitHub package.json version GitHub

This bot can show both Social and Importance° rates for any account of UOS° Network. Also, anyone can link their telegram account to their UOS° account to query any linked telegram accounts for rates.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project for production uses.

Prerequisites

First of all, you need to create Telegram bot with the help of @BotFather.

BotFater Documentation.

You need your bot token from BotFather.

Installing

Clone the repository

git clone https://github.com/UOSnetwork/uos-score-bot.git

Create a .env file from env.sample and replace placeholders with actual values

NODE_ENV=development
TOKEN=<TELEGRAM BOT TOKEN> - Put your bot token here
AUTH_USER_ID=<TELEGRAM USER ID> - Your telegram account ID (It's not used atm, so you can put any number)
DATABASE_URL=<PG DB URL> - PostgreSQL database connection URL, more on this later
...

This bot uses a PostgreSQL database to store linked account data, there is a sample file to create the scheme.

DROP TABLE public.tbl_accounts;

CREATE TABLE public.tbl_accounts
(
    tg_uid bigint NOT NULL,
    tg_name character varying(255),
    uos_name character varying(12) NOT NULL,
    last_updated timestamp without time zone,
    CONSTRAINT tbl_accounts_pkey PRIMARY KEY (tg_uid)
)

Then you can proceed with

npm install

Running the bot

To start the bot run

node bot

How to use the bot

You can use the bot using the following commands:

/link <UOS account name> - Links your telegram account to specified UOS account
/unlink - Unlinks your telegram account from any linked UOS accounts
/check <Telegram/UOS account name> - Check the score of any telegram account (starting with @) or UOS account, sending this command without arguments shows your own score

Deployment

For production, you can deploy it on Heroku or any other similar service.

Built With

  • Telegraf - Modern Telegram Bot Framework for Node.js
  • Knex - A SQL Query Builder for Javascript
  • EOSJS - General purpose library for the EOS blockchain.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Help

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Telegram bot to query UOS Network Social and Importance° rates

Resources

License

Stars

Watchers

Forks

Packages

No packages published