Open aledrstudio opened 11 months ago
` function sendTextToChannel() {
bot.sendMessage({
chat_id: '@sviluppo1234',
text: 'Questo è un messaggio di esempio dal mio bot React.',
});
}`
This is my code, but it doesn't work, 'bot' is the instance of the telegram Bot created here:
`import { UrbanBotTelegram } from '@urban-bot/telegram';
import { render, Root } from '@urban-bot/core';
import dotenv from 'dotenv';
import { App } from '../App';
import PreHome from '../page/PreHome';
dotenv.config();
const { TELEGRAM_TOKEN, PORT } = process.env;
const isDevelopment = process.env.NODE_ENV === 'development';
if (!TELEGRAM_TOKEN) {
throw new Error('Provide TELEGRAM_TOKEN to .env https://core.telegram.org/bots#6-botfather');
}
const urbanBotTelegram = new UrbanBotTelegram({
token: TELEGRAM_TOKEN,
isPolling: true,
});
render(
<Root bot={urbanBotTelegram} port={PORT ? Number(PORT) : undefined}>
<PreHome bot={urbanBotTelegram}></PreHome>
</Root>,
() => console.log('telegram bot has started'),
);
`
chat_id: '@sviluppo1234',
because this isn't chat_id
. You tried to pass nickname
into the property chat_id
Hii, how can I send a message to a channel when a user click a button?