Alternative of ctx.updateSubTypes Telgraf 4
Solution 1:
This is an alternative usage to ctx.updatesubtypes
AKA getting message type in telegraf 3.
bot.use((ctx, next) => {
console.log(`Message Type is: ${getMessageType(ctx.message)}`);
// Message Type is: STICKER or Message Type is: TEXT
});
const getMessageType = (message) => {
var keys = Object.keys(message);
var messageType = keys.pop();
console.log(messageType);
return messageType.toUpperCase();
};
source is: https://stackoverflow.com/a/58052712/10694425