A Telegram bot with some random and useful features. https://t.me/smallBug_bot
- @smallBug_bot g (query) : Perform an inline/interactive Google Search.
- @smallBug_bot t (text) : Translate text to english.
- /newtag tag message : Save a message (admins only).
- tag : show the saved message.
- /alltags : List all tags in the current group.
- /deltag tag : Delete tag (admins only).
- /boot : Use when really angry at someone. Doesn't actually kick.
- /pun : Sends a random pun from a predefined list of puns.
Stores the provided message in a list.
- /newreq request : Add a new request for the group. Useful for things like feature requests.
- /allreqs : Show all requests for this group (autodelete in 60 seconds).
- /delreq requestNumber : Delete the specified request (bot owner, group admin, and original requester only). There's no validation before confirmation, so things like "/deltag The biggest idiot" will produce interesting results.
This bot also contains a copy of TagAlertBot.
This bot needs the "privacy" attribute to be set to "disabled" and the inline attribute to be set to "enabled" from Botfather.
This bot was written using heroku-node-telegram-bot. The below are the hosting instructions from heroku-node-telegram-bot, modified for Buginator.
- Create a new bot using Telegram's BotFather and copy your TOKEN.
- Send "/setprivacy" to BotFather, and set it to "disabled".
- Send "/setinline" to BotFather, and turn it on.
- Clone or download and unpack this repo.
- Go to the app's folder.
- Run
npm install
(in some cases you will need to run this with sudo). - Rename .env_example file into .env and set TOKEN to the value you've got from the BotFather.
- Send the bot a message.
- Go to https://api.telegram.org/bot(botToken)/getUpdates.
- Copy the value for result[0].message.from.id, and set OWNER to that value in .env.
- Go to https://api.telegram.org/bot(botToken)/getMe.
- Copy the value for result.id, and set BOT_ID to that value in .env.
- Run
npm start
. As there is no PostgreSQL database, many of the features won't work yet.
- Create an Heroku account and install the Heroku Toolbelt.
- Provision Heroku Postgres.
- Login to your Heroku account using
heroku login
. - Go to the app's folder.
- Run
heroku create
to prepare the Heroku environment. - Run
heroku config:set TOKEN=(botToken)
. - Run
heroku config:set HEROKU_URL=$(heroku info -s | grep web_url | cut -d= -f2)
. - Run
heroku config:set OWNER=(OWNER from step 10 in the previous section)
. - Run
heroku config:set BOT_ID=(BOT_ID from step 12 in the previous section)
. - Run
git add -A && git commit -m "Commit message" && git push heroku master
to deploy the bot to Heroku.
All features will now work.
To use Heroku Postgres while developing locally, run source .setHeroku
before running npm start
. That script also adds a few aliases that are useful while running on Heroku.
In development mode, the bot works using polling and on the heroku server it uses a webhook, because Heroku will shut down the bot after a period of inactivity. That would have resulted in the polling loop shutting down, too. Once a webhook is enabled, Telegram will return an error {"ok":false,"error_code":409,"description":"Error: Conflict: another webhook is active"}
when you try to use polling again.
To go back to development mode, run npm run switch_to_dev
. This script will disable the current webhook and start the bot locally. Run git push heroku master
when done, to deploy it to Heroku. Then restart the bot using heroku restart
. It will set the webhook again.
The puns were copied from here.
The /boot messages get generated with this, from here.
This bot was written using heroku-node-telegram-bot.
It contains a copy of TagAlertBot.