Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.21 KB

File metadata and controls

56 lines (39 loc) · 2.21 KB

python-telegram-bot

This is a telegram bot written in python. It uses the CLI of telegram by vysheng to connect.

Installation

Install and setup vysheng/tg

Install vysheng's tg cli

git clone https://github.com/vysheng/tg.git && cd tg
./configure
make

Run that and configure an account

./telegram -k tg-server.pub

Install dependencies

The twitter module requires Python Twitter Tools

sudo easy_install twitter
twitter authorize

Download python-telegram-bot

Clone this repository by doing

git clone https://github.com/asdofindia/python-telegram-bot.git && cd python-telegram-bot

Configure python-telegram-bot

There are a few changes to be made to the source code before it can start working.

In bot.py, change pathtotg to the path to the vysheng's tg CLI In bot.py, in the twitter function, change groupeer to the telegram user to whom you want the bot to send a message when there's a new tweet. In bot.py, in the twitter function, change the follow array to the accounts you want to get updates from In wolfram.py, put an appid by signing up at wolfram developers

Disabling modules

If you don't want some of these modules, just remove them from the modules array in callmodule function If you want to disable twitter, just comment out all lines with 'twitbot' in it in the main function. If you want to disable robotic replies turn chattybot to False

Features

The features as of now are

  • can be invoked from within a group or a direct message
  • wiki will return the first paragraph of the wikipedia article
  • google will return a few google results
  • bot will fetch the answer from wolfram alpha api
  • new twitter messages from your feed are automatically sent to the defined peer
  • talks random shit based on pandorabots web service thanks to chatterbotapi

Known Bugs

  • twitter module repeats tweets. This is more of a problem with the twitter python module rather than this code. Todo: prevent duplicate tweets using timestamp
  • chatting with oneself is buggy, I suppose. Not tested very much. No time :P