node-telegram-firestore-message-replier
Node module which allows the bot to reply to a random message in the chat.
You just set the probability between 1 and 100 and then the magic happens.
Install:
npm install node-telegram-firestore-message-replier
Use:
First create your own firestore db instance
node-telegram-firestore-message-replier initially works with node-telegram-bot-api.
const TelegramBot = ;const TelegramFirestoreMessageReplier = ; // initializeconst bot = 'BOT_TOKEN';const replier = bot firestore: credential: databaseUrl: 'https://YOUR_FIREBASE_URL.firebaseio.com' docPath: 'collection/chats' showChanceMessage: 'Current chance is CURRENT_CHANCE%' setChanceMessage: 'Current chance changed from CURRENT_CHANCE% to NEXT_CHANCE%' // CURRENT_CHANCE and NEXT_CHANCE strings will be replaced with currentChance and nextChance values; // on command "/chance" will show current chance valuebot; // on command "/setchance 30" will set chance value to 30% to reply to the message// command "/setchance" without value is equal to "/chance". So you can use only one command in your botbot; // handle each message to be ready for replyingbot;
Options:
bot: <your bot instance> // previously created bot via node-telegram-bot-api firestore: <object> // firestore db instance params showChanceMessage: <string> // set message for show chance command setChanceMessage: <string> // set message for change chance command;