Closed wudb closed 3 months ago
You must pass a chat identifier, but passing a user identifier. You need to create the chat with self (Saved Messages) first by calling createPrivateChat
, receive its identifier, and then use the identifier.
thanks! So how do I judge whether I can send a story? Because some users can choose chat, and when some users cannot choose, they need to createPrivateChat?
Use getChatsToSendStories
and canSendStory
.
Thanks! Telegram app does not need to have a chat before it can send story. Why does tdlib need to have a chat before it can send story?
I encountered this error when forwarding the story: Can't use file of type PhotoStory as Photo. code:
Future<bool> forwardStory(int chatId, td.Story story) async {
if (client != null && story.canBeForwarded) {
td.InputStoryContent? input;
if (story.content is td.StoryContentPhoto) {
final content = story.content as td.StoryContentPhoto;
final photo = content.photo.sizes.last;
input = td.InputStoryContentPhoto(photo: td.InputFileRemote(id: photo.photo.remote.id), addedStickerFileIds: const []);
} else if (story.content is td.StoryContentVideo) {
final content = story.content as td.StoryContentVideo;
final video = content.video.video;
input = td.InputStoryContentVideo(video: td.InputFileRemote(id: video.remote.id),
addedStickerFileIds: const [],
duration: content.video.duration,
isAnimation: content.video.isAnimation
);
}
if (input != null) {
final result = await client!.send(td.SendStory(
chatId: chatId,
content: input,
caption: story.caption,
privacySettings: const td.StoryPrivacySettingsEveryone(exceptUserIds: []),
activePeriod: 86400,
fromStoryFullId: td.StoryFullId(senderChatId: story.senderChatId, storyId: story.id),
isPostedToChatPage: true,
protectContent: false,
));
Log.d("TG | forwardStory result: ${result.toJson()}");
return result is td.Story;
}
}
return false;
}
please help me, thanks!
When I call the above method to forward the video story, I pass in the chatId created by createPrivateChat and the sending is successful, but I cannot see the story I forwarded on my wall.
All Telegram apps works in exactly the same way as TDLib.
All Telegram apps works in exactly the same way as TDLib.
now, I can use createPrivateChat to send stories. The sending is successful, but I cannot see the story on the app. The code is as above.
Then, you didn't send the story. Did you wait for updateStory
with story.is_being_sent
being false?
story.is_being_sent is true, But I can’t see the story I posted on the telegram app.
You definitely must not see in other apps a story that isn't sent yet.
The sendStory shows success, and the is_being_sent in updateStory also shows success. Where does it indicate that the story was not sent successfully?
is_being_sent
shows that the story is being sent.
thanks! It's ok, caption is too long.
I use sendStory to send the story, but when the chat id is passed into my own id, an error is reported: “Chat not found”, please help me, thank you.
code show as below:
final input = td.InputStoryContentPhoto( photo: td.InputFileLocal(path: path), addedStickerFileIds: []); final result = await client.send(td.SendStory( chatId: me.id, content: input, privacySettings: const td.StoryPrivacySettingsEveryone(exceptUserIds: []), activePeriod: 86400, fromStoryFullId: null, isPostedToChatPage: true, protectContent: false, ));