how to send auto delete messages whit Telegram bot - python

I have a doubt. I've been looking for information and haven't found anything. I would like to know if it is possible to send a message with a bot which will be eliminated after a certain time. I'm working with c# but I think other examples will work for me. Thanks in advance.

I thought I would delete my own message after a while but I think it would not be a solution in a well active chat, since there are many messages coming in all the time and I would not know for sure what the id of the message I sent is. I would have to do another algorithm to find out what that id is, and what I was trying to see is if there was some simpler method already implemented in the api for these specific cases. Send messages using the bot with self-destruct after a while.

I'm not sure if telegram API provides that.
but you can implement it in the bot to do that, maybe with "time" or "schedule" in python

Related

How to save the information in Telegram notification by python ? (possible?)

I want when someone sends a message in Telegram, the information of the message is stored in the telegram bot or something else without seeing the other party's message.
I assume you want to do what is known as "ghost mode" which means you read messages but they're not double-checked.
Before I answer your question, I should warn you that Telegram's founder is against such use (see https://twitter.com/durov/status/891227609706536960).
The fun fact is you don't have to do anything to avoid double-checking a message. In fact there is an extra step for that. Therefore, all you need to do is to read the message. You can do so in telethon as simple as this:
#app.on(events.NewMessage())
def read(event):
print(event.message.message)

Is there a way for a Telegram Bot to send a text to everyone who has a pending join request in a channel using pyTelegramBotApi

I am trying to make a Telegram bot that dms anyone who requests to join a channel, goes through an authentication process in the dms and then approves or rejects the request. The problem I have right now is that there are already a lot of pending join requests. I need the bot to text those people as well. So I was hoping there might be a way to get a list of join requests. But I have gone through the documentation and even the source code of pyTelegramBotAPI but failed to find a solution. So I was wondering whether this is actually possible or not.
Thanks in advance.

Is it possible to make a python bot that sends Youtube live chat messages?

I'm trying to make a youtube bot for a friend who streams often. I already looked into pytchat, which worked pretty well in retrieving chat messages, but I don't think it has a way to send messages. I'm not sure if this is even possible.
It is completely possible.
Taking a brief look at pytchat, indeed it looks like it has no way to send messages.
But there is an official API to post messages. Depending on your experience level, you may find it easy to use it.
There are several ressources (YouTube videos, medium articles, ...) that explain how to use the API to build a rudimentary bot.

How to use a user account to fetch/get messages (discord.py)

I have 2 discord client instances a bot and a user account. I have already figured out how to copy messages from one channel to another channel, basically a on_message event. However, I want to know if there is a way I can use the user account to fetch the messages, I've tried fetching messages in different guilds but they didn't work because the bot was not in the server and the bot is fetching messages. I've tried using the user account instance to do it but it didn't really work.
The comments were there as a guide for myself because I'm not that familiar with Python it's fairly new to me. If anyone knows how I can use the user account to get or fetch the messages I'd appreciate the help...
PS: I know that some of the code isn't needed, I haven't removed anything that isn't needed. I wanted to actually finish the project before inspecting it.
I just wanted to know that I have tried this myself and it is not possible. Because from discord.py's Docs. Which you can find down below, does not allow users (user account) to transfer data to a bot since you would need to request from discord API which leads to user getting banned (Very quickly) theere are some work arrounds but I would suggest not doing so since self botting is against the TOS of discord
https://discordpy.readthedocs.io/en/stable/
EDIT: Another thing is that discord API blocks users from fetching or getting anything using a user account with discord.py

Facebook messenger chatbot gives duplicate replies

I'm building a chatbot with wit.ai and python and integrating it with Facebook Messenger. I have set up webhooks as well as send function and fb_message function exactly like in this tutorial: https://github.com/wit-ai/pywit/blob/master/examples/messenger.py
My bot works fine when I test it in wit.ai or in console, but when I test it in actual Facebook Messenger, it gives each reply twice. It doesn't matter which function inside the bot gets called, I always get two replies.
My most simple action is this:
def defaultAnswer(request):
context = request['context']
return context
(This returns always the same string, which is defined in wit.ai engine.)
If your bot is subscribed to events other than pages_messaging, like messaging_deliveries, make sure you're handling this event as well.
What's happening is your that bot is receiving the message request, then receiving another one by another event, and your code is handling them both as messages.
I think this is the problem, and if it's not, give us more details about it.
Someone might have a case like mine.
My case:
I mistakenly subscribe my two different bots to one facebook page on the developer.facebook.com.
Due to the this mistake, when i write a specific command(e.g. restart) to my facebook page, bot replies exactly same two messages(e.g. "Bot Restarted", "Bot Restarted") to me.
It made me a crazy to find out the problem.
You should subscribe one bot to your facebook page at most.
I had this issue before and it turns out, the message_echoes was enabled. What happens essentially if this is enabled is that the Bot will try to echo whatever you text you entered.
My logic ended up catching the echo and then responded with the same response. I do have a handler to catch similar responses so I was able to avoid the infinite loop.

Categories