mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
[Temp] Create bot forum on Start
This commit is contained in:
parent
826c48a4dc
commit
ded7e9695e
@ -6,8 +6,7 @@ import MtProtoKit
|
||||
|
||||
|
||||
func _internal_requestStartBot(account: Account, botPeerId: PeerId, payload: String?) -> Signal<Void, NoError> {
|
||||
#if DEBUG
|
||||
if !"".isEmpty {
|
||||
if "".isEmpty {
|
||||
return account.postbox.loadedPeerWithId(botPeerId)
|
||||
|> mapToSignal { botPeer -> Signal<Void, NoError> in
|
||||
guard let inputUser = apiInputUser(botPeer), let botPeer = botPeer as? TelegramUser, let botInfo = botPeer.botInfo else {
|
||||
@ -34,7 +33,30 @@ func _internal_requestStartBot(account: Account, botPeerId: PeerId, payload: Str
|
||||
}
|
||||
}
|
||||
|
||||
return .complete()
|
||||
if let payload = payload, !payload.isEmpty {
|
||||
return account.postbox.loadedPeerWithId(botPeerId)
|
||||
|> mapToSignal { botPeer -> Signal<Void, NoError> in
|
||||
if let inputUser = apiInputUser(botPeer) {
|
||||
return account.network.request(Api.functions.messages.startBot(bot: inputUser, peer: .inputPeerEmpty, randomId: Int64.random(in: Int64.min ... Int64.max), startParam: payload))
|
||||
|> mapToSignal { result -> Signal<Void, MTRpcError> in
|
||||
account.stateManager.addUpdates(result)
|
||||
return .complete()
|
||||
}
|
||||
|> `catch` { _ -> Signal<Void, MTRpcError> in
|
||||
return .complete()
|
||||
}
|
||||
|> retryRequest
|
||||
} else {
|
||||
return .complete()
|
||||
}
|
||||
}
|
||||
|> castError(MTRpcError.self)
|
||||
} else {
|
||||
return enqueueMessages(account: account, peerId: botPeerId, messages: [.message(text: "/start", attributes: [], inlineStickers: [:], mediaReference: nil, threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])]) |> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> castError(MTRpcError.self)
|
||||
}
|
||||
}
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
@ -65,7 +87,6 @@ func _internal_requestStartBot(account: Account, botPeerId: PeerId, payload: Str
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if let payload = payload, !payload.isEmpty {
|
||||
return account.postbox.loadedPeerWithId(botPeerId)
|
||||
|
@ -1746,7 +1746,7 @@ public final class ChatSideTopicsPanel: Component {
|
||||
self.rawItems.removeAll()
|
||||
for item in chatList.items.reversed() {
|
||||
if case .botForum = component.kind, case let .forum(topicId) = item.id, topicId == 1 {
|
||||
#if DEBUG
|
||||
#if DEBUG && false
|
||||
#else
|
||||
continue
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user