I'm creating a Reddit bot with praw, and I want to have the bot do things based on private messages sent to it. I searched the documentation for a bit, but couldn't find anything on reading private messages, only sending them. I want to get both the title and the content of the message. So how can I do this?
Didn't find it in the docs, but a friend who knows a bit of raw helped me out.
Use for message in r.inbox.messages() (where r is an instance of reddit) to get the messages.
Use message.text to get the content, and message.subject to get the title.
Related
I'm having issues sending multiple embeds in one response and I'm not entirely sure if it's my fault (mostly likely) or a bug with discord.py.
I have a list of embeds I'm trying to follow up on an initial deferral. However, my bot only seems to ever send one embed, rather than sending the full list. The full code is here but the important bits I'll describe below:
My bot asks the discord API to defer it's response in order to conduct the multitude of REST API requests, searching and parsing it has to do. This theoretically buys me 15 minutes to respond to the user's request properly
# Send directory contents if no search term given
await interaction.response.defer(thinking=True)
It then does a bunch of parsing and ends up with a dictionary of some discord.File's and embeds. The embeds are created using the basic discord.Embed format to the responses variable:
{'files': [], 'embeds': [<discord.embeds.Embed object at 0x106f3b0a0>, <discord.embeds.Embed object at 0x106f3aef0>, <discord.embeds.Embed object at 0x106f3b250>]}
I then try to send this dictionary in a reply but it only ever seems to send one embed:
print(f"SENDING RESPONSES: {responses}...")
await interaction.followup.send(embeds=responses["embeds"], files=responses["files"])
See image for the singular response in the Discord UI
Can someone please clarify for me what I should be doing or if this is a genuine bug or documentation issue in discord.py?
Thanks
Now resolved thanks to the owner of discord.py
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)
CONTEXT:
Im trying to make a reminder system on whatsapp (TWILIO AUTOPILOT)
and to change state of task from incomplete to complete i thought it would be easy if user tags or replies to a particular reminder with done.
QUESTION:
If a user tags or replies to a message, is there a way i can retrieve information about that message, example the text in contained
IMAGE:
output needed in this case:
"Todays List: ... etc etc"
Twilio developer evangelist here.
I'm afraid that information is not currently available in the Twilio API for WhatsApp. You can see the extra parameters that you receive in the webhook for a WhatsApp message here, including parameters like ProfileName, WaId, Forwarded, FrequentlyForwarded and ButtonText, but nothing to do with replied to messages.
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
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