Grant access to telegram bot in chats - python

I have a slightly different question about telegram bot using botfather. Is it possible to grant access to the bot in some private chat on my telegram? For example: I am on a telegram channel, and I would like the bot to have access to these messages without having to put the bot on the channel.
I'm currently using Python 3.10x and I'm using the telegram API via requests (I'm not using any libraries).
I thought that since there is the /getUpdates endpoint that makes the bot read messages where it has access, maybe it can also have access to some private chat of any user (as long as the user obviously allows it somehow)

Related

How delete all message in telegram chat? (python, telegram.ext)

I encountered the problem of deleting all messages (including messages from the bot itself) in the telegram chat. How i can do this? I use the telegram.ext library.
Telegram Bot API doesn't have methods to delete multiple messages. You have to know message_id to delete it.
python-telegram-bot library has support to only Bot API. You can make use of telethon library which supports Telegram API.
There is a delete_message method in the bot object, as described in the python-telegram-bot Documentation
Example:
bot.delete_message(chat_id=message.chat_id,
message_id=message.message_id,
*args,
**kwargs)
Remember that there are some limitations:
A message can only be deleted if it was sent less than 48 hours ago.
Bots can delete outgoing messages in groups and supergroups.
If the
bot is an administrator of a group, it can delete any message there
If the bot has can_delete_messages permission in a supergroup or a
the channel, it can delete any message there.

How can i get someone telegram chat id with python?

Hi everyone i want to create a new telegram bot similar to #usinifobot.
this is how it works:
you just send someone username to this bot and it will give you back his/her chat id.
i want to do same thing but i dont khow how to do it with python-telegram-bot.
python-telegram-bot can't help with this, because telegram bot api can't provide ids of unrelated entities to the bot - only ones with which bot iteracts
you need telegram client api for this and to hold a real account (not a bot) online to make checks by another library
and with bot library like python-telegram-bot you could only get ids of users who write to bot, channels and groups bot is in and reposted messages from other users
I created similar bot #username_to_id_bot for getting ids of any entity and faced all these moments

Is it possible to get all channels a slack bot is allowed to write?

I am trying to build a slack bot based on heroku and python which writes messages every 10 minutes to all channels the bot is allowed to write messages. It would be perfect if I could just read from the slack api to which channelId's the bot is connected and let the bot post the message to all channels at the same time.
Till now I couldnt find such function in the slack api. On the other hand I have to addmit that I am pretty new to slack. Is there a similiar function out there or can you think of a work around? If possible I would like to avoid storing data additionally somewhere.
Yes there is. Call users.conversations with your bot token to get the list of channels it is a member of.
From the documentation:
This method helps answer questions like:
Which conversations am I a member of?
Which public channels is my bot user in?
Do I have any direct messages open with my friend Suzy?
Is my bot a member of any private channels?

CLIENT side of telegram bot, is it possible?

For telegram messenger, is it possible to create bot that resides on PC side, i.e. on user's side of telegram ? (all telegram bot tutorials assumes you need telegram bot "from telegram side", i.e. bot that interact with user, but I need bot on other side of conversation, on PC (from my side), need bot that interact with existing telegram channels/bots/users). Is there any python bot module for this task?
Thanks for any help.
Here is a solution that works perfectly:
https://github.com/LonamiWebs/Telethon

Scrape Telegram channel for changes

Can anyone point me to a way to programatically check for changes in a Telegram room? I can't decipher the API. I want to do something like:
telegram.onMessageReceived('room_id', (msg) => {
console.log(msg.content);
}
I usually use Python, but open to using NodeJS because I want to have it always running, monitoring for changes on an Ubuntu server.
As far as I can find on the internet, everything is pointing to the bot API, but as I understand it, it would only be notified of updates to messages to the bot. I want to monitor public rooms in which I cannot add the bot as an administrator since I did not create the room. Or is there some way to add a bot to public rooms? I don't think so.
Also the room I want to monitor doesn't allow anyone to chat. It's just to notify subscribers.
I've read these SOs so far and am still confused:
Can a Telegram bot read messages of channel
How do I join my bot to the Channel?
How to join my Telegram Bot to PUBLIC channel
in node.js telegram library you can check the last message.date and compare with last date you have stored. if changed there is new message

Categories

Resources