kykint

Use direct translation only on private chats

Otherwise it would reply to every single message on e.g. group chats.
Showing 1 changed file with 4 additions and 2 deletions
......@@ -34,10 +34,12 @@ bot.onText(/\/echo (.+)/, (msg, match) => {
// Listen for any kind of message. Translate if it's not a command.
bot.on('message', (msg) => {
const chatId = msg.chat.id;
const chatType = msg.chat.type;
const received_msg = msg.text;
// Ignore if input is a command
if (received_msg[0] == '/') {
// Ignore if input is a command or we are not on a private chat,
// since direct translation is to be used only on private chats.
if (received_msg[0] == '/' || chatType != 'private') {
return;
}
......