I am trying to post some messages on a channel using the pytg library which is also using the vysheng telegram-cli. I tried some options like
sender.send_msg("ChannelName", "Message")
sender.fwd("ChannelName", msg.id)
From these lines I am getting this error message
pytg.exceptions.FailException: Error 71: 'RPC_CALL_FAIL 400: CHANNEL_MESSAGES_DISABLED'
Searching inside Google/GitHub I did find this vysheng issue # 1033 that mentions that we need to send a post to a channel and not a message. But the pytg help(Sender) does not mention anything similar.
I have looked into the possibility of using a bot or other libraries but it's not really what I want.
Is there somebody familiar with pytg that can direct me in the proper direction?
Thx in advance
I was able to achieve this by using the raw command inside pytg, I guess there's a better solution out there but for the moment this one works!
sender.raw("post #nameOfChannel " + msg.text)
Related
How can I edit VideoNote message and change old video note to another one in Telebot? I guess I need edit_message_media method, but I don't understand how to use it for video notes.
I've tried to do it this way:
bot.edit_message_media(chat_id=message.chat.id, message_id=message.message_id,
media=types.VideoNote(open("video.mp4", "rb")))
But it didn't work.
It seems it is impossible as for now (December 2022).
Telegram API has these methods for updating messages: editMessageText, editMessageCaption, editMessageMedia, editMessageReplyMarkup, stopPoll, deleteMessage,
The closest one is editMessageMedia but it expects InputMedia which in turn should be one of InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo, but not VideoNote
Also, I tried editing this kind of message using the official Android and Windows clients but didn't find such an option.
I assume Telegram doesn't have this option at all.
I need to mention particular user in the message that I sent to a group in Skype. I can send the message easily with the skpy but can't figure it out how to mention someone in the message.
sk=Skype("userid","paasword")
SendMsgTo=sk.chats["group-id"]
SendMsgTo.sendMsg("hello")
there is this sendRaw() thing in skpy which I think I'll have to use, but can't figure it out how to use.
I am new to python and finding my way through the google and the great community of stackoverflow and the similar. So a little help will greatly be appreciated
You can use
SendMsgTo.sendMsg('<at id="8:USER_ID">USER_NAME</at> ', rich=True)
also, if you don't know USER_ID use the SendMsgTo.userIds to find all USER_ID in the group
i need to write code that will read messages from user and reply but i’ve got to use exactly this function: GetDialogs Request, not event method. please help, can't find any information about it
The request you mention, GetDialogsRequest, is part of what's known as "raw API". Both pages of the documentation contain examples. However, as noted in the first link, you probably want to use client.iter_dialogs (the link again contains an example):
# Print all dialog IDs and the title, nicely formatted
async for dialog in client.iter_dialogs():
print('{:>14}: {}'.format(dialog.id, dialog.title))
This may not be the request you're looking for though, as this returns a list of open conversations. Following the documentation would be a good way to understand what's happening and what you should use.
I have been using the PyTelegramBotAPI to handle current location with the content handler:
#bot.message_handler(content_types=['location'])
I am able to get the latitude and longitude which is really great.
However, below the current location option, I can send the bot a place. (seems that it does not have lat/lon data but it is an address) Which content handler should I use to handle it? I tried finding some documentation on https://pypi.org/project/pyTelegramBotAPI/0.3.0/ but i cant find any :(
Many thanks if you could point me in the right direction :)
Attached a picture of the send current location/place option:
Solved! Use
#bot.message_handler(content_types=['venue'])
to handle places sent by users.
I've been working on something using API.AI to create a Google Action that will send random web comics when asked. I have tried and tried, but so far it doesn't seem like there is a good way to put the image's bytes into the JSON response required for API.AI. I might have missed something along the way, but if anyone knows how this can be accomplished that would be of great help. I have been using python if that helps.
You can get or put images as a response from Api.ai just put url of that image . Here is some useful docs link :
https://docs.api.ai/docs/rich-messages#image
https://docs.api.ai/docs/query#section-message-objects