Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a message handler to the bot ? #194

Open
xMA3x opened this issue Mar 25, 2021 · 4 comments
Open

How to add a message handler to the bot ? #194

xMA3x opened this issue Mar 25, 2021 · 4 comments

Comments

@xMA3x
Copy link

xMA3x commented Mar 25, 2021

I want to
1- log (date, user name,chatid, first name, last name) for every message that a user sends
and if it possible it be in a spreadsheet

2- store every chatid that used the bot, so i can send a message to evrey user
and if there is another way, i will appreciate it

@TeLoardBruh
Copy link

hello,

for the

  • first question I believe it is in the GitHub readme below the files, just scroll downwards and spends times reading the documents that the author wrote, you will see something like this
    Screenshot (46)

  • same goes to your second question, what you should looking for is something like "msg.chatId"

feel free to ask for further clarify .

@TeLoardBruh
Copy link

or msg.from.id,

@xMA3x
Copy link
Author

xMA3x commented Mar 29, 2021

hello,

for the

  • first question I believe it is in the GitHub readme below the files, just scroll downwards and spends times reading the documents that the author wrote, you will see something like this
    Screenshot (46)
  • same goes to your second question, what you should looking for is something like "msg.chatId"

feel free to ask for further clarify .

I haad already found a way in KittyBot.js example that shows how to log every msg

// Log every text message
bot.on('text', function (msg) {
    console.log(`[text] ${ msg.chat.id } ${ msg.text }`);
});

but the idea is: how I can SAVE the log, even after deploy it to Heroku
is there is a way to save it to a spreadsheet ?
or i will have to add a test file to save the log ?
or Heroku will show it in the log acticity?

and for the secand on, even after saving the chatid, how I will be able to send them a msg?

@TeLoardBruh
Copy link

to save log into database you need to create a function that do so, look up for something like "save info in rest API" something like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants