UNPKG

telebot

Version:

The easy way to write Telegram bots.

30 lines (26 loc) 910 B
/* eslint-disable no-debugger, no-console */ import { TeleBot } from "../src"; import { Levels } from "../src/telebot/devkit"; import * as fs from "fs"; const bot = new TeleBot({ token: "73107572:AAFaHaTic_5bEWhYuyIa7h0pSMeM8dcApwU", // polling: { // interval: 1000 // }, debug: { levels: [Levels.fatal, Levels.error, Levels.warn, Levels.log, Levels.info]//, Levels.debug] // types: ["request", "response"] // ids: ["my.event"] } // webhook: { // url: "https://034d1707.ngrok.io", // host: "localhost", // port: 8080 // } }); bot.on("text", async (message) => { await bot.sendPhoto(message.chat.id, __dirname + "/img.jpg"); // const result = await bot.sendDice(message.chat.id, "🎲"); // await bot.sendMessage(message.chat.id, `<b>Result:</b> ${result.dice?.value}`, { parse_mode: "html" }); }); bot.start();