Is there any alternative way to every upcoming contract addresses in my Telegram Community like RemoveETHAddress bot? Please see the code from below. It won’t let me use ‘getUpdates’ unless I delete the webhook, if I delete the webhoo the bot will no longer monitor the server
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
telegramBotToken: {
type: "string",
label: "Telegram Bot Token",
secret: true,
description: "Your Telegram bot token",
},
chatId: {
type: "string",
label: "Chat ID",
description: "The ID of the Telegram chat where you want to monitor contract addresses",
},
},
async run({ $ }) {
const deleteWebhookUrl = `https://api.telegram.org/bot${this.telegramBotToken}/deleteWebhook`;
await axios($, {
method: "GET",
url: deleteWebhookUrl,
});
const regex = /0x[a-fA-F0-9]{40}/;
const getUpdatesUrl = `https://api.telegram.org/bot${this.telegramBotToken}/getUpdates`;
const updates = await axios($, {
method: "GET",
url: getUpdatesUrl,
});
for (const update of updates.result) {
if (update.message.chat.id === this.chatId && regex.test(update.message.text)) {
const warningMessage = "Warning: A contract address has been detected in the chat.";
const sendMessageUrl = `https://api.telegram.org/bot${this.telegramBotToken}/sendMessage`;
await axios($, {
method: "POST",
url: sendMessageUrl,
data: {
chat_id: this.chatId,
text: warningMessage,
},
});
}
}
},
});