Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mtkruto/types/6_update.ts>UpdateNewMessage

Cross-runtime JavaScript library for building Telegram clients
Latest
interface UpdateNewMessage
import { type UpdateNewMessage } from "https://deno.land/x/mtkruto@0.6.3/types/6_update.ts";

A message was sent or received.

// Handle text messages
client.on("message:text", (ctx) => {
  const receivedOrSent = ctx.message.out ? "sent" : "received";
  console.log("Just", receivedOrSent, "a text message:", ctx.message.text);
});

// Handle other messages
client.on("message", (ctx) => {
  if (ctx.message.out) {
   console.log("Just sent a message.");
  }
});

Note that updates on outgoing messages are disabled by default for bots.

Properties

message: Message

The sent or received message