CLIENT side of telegram bot, is it possible? - python

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

Related

Telegram start new chat with HTTP requests, no BOT nor API

I want to start a new chat in Telegram with a Python script but I know with neither Telegram's BOT nor its API it is possibile.
If so, why can I start a new chat on Telegram Application (or Web) with someone?
I suppose Telegram client sends HTTP/s requests to achieve this. Is this feature possible to replicate with a Python script?

Grant access to telegram bot in chats

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)

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

Set Discord User to AFK in python

i have a discord bot written in python and it uses a users discord auth token. When th program is running it wont send any mobile notifications because it makes discord think im online and wont go afk for the afk timer to kick on. Is there a way to use the auth token and not have discord think im logged in? or is there a way to make discord think the user is afk? any help would be gratly appreciated!!
Use Client.change_presence()
await bot.change_presence(status = discord.Status.idle)
Here are the different kinds of Status available.

Categories

Resources