Home telegram - send media
Post
Cancel

telegram - send media

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public static func sendMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, media: Api.InputMedia, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, scheduleDate: Int32?, sendAs: Api.InputPeer?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
    let buffer = Buffer()
    buffer.appendInt32(-497026848)
    serializeInt32(flags, buffer: buffer, boxed: false)
    peer.serialize(buffer, true)
    if Int(flags) & Int(1 << 0) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
    media.serialize(buffer, true)
    serializeString(message, buffer: buffer, boxed: false)
    serializeInt64(randomId, buffer: buffer, boxed: false)
    if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
    if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
    buffer.appendInt32(Int32(entities!.count))
    for item in entities! {
        item.serialize(buffer, true)
    }}
    if Int(flags) & Int(1 << 10) != 0 {serializeInt32(scheduleDate!, buffer: buffer, boxed: false)}
    if Int(flags) & Int(1 << 13) != 0 {sendAs!.serialize(buffer, true)}
    return (FunctionDescription(name: "messages.sendMedia", parameters: [("flags", flags), ("peer", peer), ("replyToMsgId", replyToMsgId), ("media", media), ("message", message), ("randomId", randomId), ("replyMarkup", replyMarkup), ("entities", entities), ("scheduleDate", scheduleDate), ("sendAs", sendAs)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
        let reader = BufferReader(buffer)
        var result: Api.Updates?
        if let signature = reader.readInt32() {
            result = Api.parse(reader, signature: signature) as? Api.Updates
        }
        return result
    })
}
This post is licensed under CC BY 4.0 by the author.