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
Related
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)
I set out to create a Telegram bot that tracks 'upvote' like functionality in a Group Chat. To try to do this, I adapted the persistentconversationbot.py code from the python-telegram-bot package. I got the bot running and managed to deploy it on to Heroku.
Once I invited the bot into a private group chat, I noticed that this approach is only remembering conversations with specific users. I'd like to have the bot remember conversations it has had with all users in a group chat. Would any of you happen to know how I can do this?
Thank you!
Please see this explanation on the per_* parameters of ConversationHandler. Note that this is independent of whether your bot uses persistence or not.
Is it possible to read discord messages from a group where you aren't an admin in python?
I've seen that discord.py is the most used library for discord related stuff but I only can find how to create a bot. I just want to read messages from a specific text channel of a group.
Is this possible?
Or do I need to use a web scraper?
Bot accounts cannot be added to group DMs. The (still unfulfilled) feature request can be found here.
Self-botting, meaning running code from your own Discord account is against the Discord TOS and might get you banned. Don't do it.
As those are the only two options there is currently no way to read Group DMs programmatically.
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?
I want to create a telegram bot which would immediately forward message from another bot, that regularly posts some info. I've tried to find some ready templates, but alas... I would be grateful for any useful info. Thanks!
I don't think this is possible. As far as I know, bots can't communicate with other bots.
But you can add bots to groups