anti-premium-stickers-bot
TypeScript bot for auto-deleting of Telegram premium stickers with some interesting features based on the grammY library
This bot was created as an additional tool to fight against premium Telegram stickers, the animations of which make any device shudder
Features
- Removes premium stickers
- Handy white/ignore lists configuration from DM
- Locale configuration via commands
- and more... (maybe)
Setup
Local
-
Create a new bot and get a bot token
-
Install
redis-cli
andnode.js
-
Clone this repository
-
Create a
.env
file in the root of the folder and pass variables into it:BOT_KEY
- bot tokenCREATOR_ID
- your ID for working with the bot whitelist/ignored list from the DM
-
Open and edit in
bot.ts
call forcreateClient
from:const client: RedisClientType = createClient({ url: `redis://${redisUser}:${redisPass}@${redisURL}:${redisPort}`, });
to
const client: RedisClientType = createClient();
This function call will use your local Redis DB
-
Run
npm i
andnpm run local
-
Wait for
Starting bot
log message -
Bot is ready to go!
If you want to pass environment variables on your system, all you need to do is run
npm start
in step 6
Heroku
- Create a new bot and get a bot token
- Create a new Redis database and get: Username, Password, Host and Port
How to create a Redis database, create a user and get the necessary data to connect will not be written here
- Create a new pipeline in Heroku, the application in it and set neccessary config vars in the settings:
BOT_KEY
- bot tokenCREATOR_ID
- your ID for working with the bot whitelist/ignored list from the DMREDIS_USER
- name of Redis DB userREDIS_PASS
- password of Redis DB userREDIS_URL
- endpoint of Redis DBREDIS_PORT
- port of Redis DB endpoint
- Push sources on Heroku (or set up auto-deployment) and wait for build
- Wait for
Starting bot
log message - Bot is ready to go!
Note about Heroku
Go to step 3 in Heroku Docker Docs to convert the stack into a container.
If something doesn't work, check the application logs in Heroku or locally and try googling the problem. If nothing helps, open an Issue with a detailed description of the problem
Bot commands
Group commands:
silent
- manage bot silent modehelp
- send help messagesilentonlocale
- change message when silent mode is enabledsilentonlocalereset
- reset message when silent mode is enabledsilentofflocale
- change message when silent mode is disabledsilentofflocalereset
- reset message when silent mode is disabledmessagelocale
- change message when bot removes stickersmessagelocalereset
- reset message when bot removes stickers
DM commands:
addwhitelist
- add group ID to white listremovewhitelist
- remove group ID from white listgetwhitelist
- get all groups info from white listaddignorelist
- add group ID to ignore listremoveignorelist
- remove group ID from ignore listgetignorelist
- get all groups ID from ignore list
Bot locale configuration
The entire locale is now stored in the locale.ts
file. Some words can be changed for chats using the commands above with locale
substring in it.
Remember to change creatorLink
in locale.ts
, which allows users to contact you for whitelist access
Changelog
The project now has a separate file CHANGELOG.md. Check it for details
FAQ
Q: How white/ignore lists are working?
When the bot is added to an unknown group, you will be prompted to add the group to the whitelist, decline the offer to add, or add it to the ignore list. The ignore list is used to prevent the bot from sending you information about future additions to the group that you have set to the ignore list. In the case of a simple rejection, the bot will not work in the new chat until you add it to the whitelist
Q: Why were these lists added in the first place?
During the tests, it became clear that with limited resources (small database memory, low system configuration, etc.), the best solution was to limit the number of chats, for less load on the infrastructure of the bot. If you want, whitelist can be cut out of the code, perhaps later will be created a separate branch for this, but not for sure
License
This repository is licensed under MIT License