move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
// Code generated by gotdgen, DO NOT EDIT.
|
||||
|
||||
package tg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/bin"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdjson"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tdp"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tgerr"
|
||||
)
|
||||
|
||||
// No-op definition for keeping imports.
|
||||
var (
|
||||
_ = bin.Buffer{}
|
||||
_ = context.Background()
|
||||
_ = fmt.Stringer(nil)
|
||||
_ = strings.Builder{}
|
||||
_ = errors.Is
|
||||
_ = multierr.AppendInto
|
||||
_ = sort.Ints
|
||||
_ = tdp.Format
|
||||
_ = tgerr.Error{}
|
||||
_ = tdjson.Encoder{}
|
||||
)
|
||||
|
||||
// MessagesTranscribeAudioRequest represents TL type `messages.transcribeAudio#269e9a49`.
|
||||
// Transcribe voice message¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/transcribe
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.transcribeAudio for reference.
|
||||
type MessagesTranscribeAudioRequest struct {
|
||||
// Peer ID where the voice message was sent
|
||||
Peer InputPeerClass
|
||||
// Voice message ID
|
||||
MsgID int
|
||||
}
|
||||
|
||||
// MessagesTranscribeAudioRequestTypeID is TL type id of MessagesTranscribeAudioRequest.
|
||||
const MessagesTranscribeAudioRequestTypeID = 0x269e9a49
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesTranscribeAudioRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesTranscribeAudioRequest{}
|
||||
_ bin.Decoder = &MessagesTranscribeAudioRequest{}
|
||||
_ bin.BareEncoder = &MessagesTranscribeAudioRequest{}
|
||||
_ bin.BareDecoder = &MessagesTranscribeAudioRequest{}
|
||||
)
|
||||
|
||||
func (t *MessagesTranscribeAudioRequest) Zero() bool {
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
if !(t.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(t.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (t *MessagesTranscribeAudioRequest) String() string {
|
||||
if t == nil {
|
||||
return "MessagesTranscribeAudioRequest(nil)"
|
||||
}
|
||||
type Alias MessagesTranscribeAudioRequest
|
||||
return fmt.Sprintf("MessagesTranscribeAudioRequest%+v", Alias(*t))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesTranscribeAudioRequest from given interface.
|
||||
func (t *MessagesTranscribeAudioRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
}) {
|
||||
t.Peer = from.GetPeer()
|
||||
t.MsgID = from.GetMsgID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesTranscribeAudioRequest) TypeID() uint32 {
|
||||
return MessagesTranscribeAudioRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesTranscribeAudioRequest) TypeName() string {
|
||||
return "messages.transcribeAudio"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (t *MessagesTranscribeAudioRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.transcribeAudio",
|
||||
ID: MessagesTranscribeAudioRequestTypeID,
|
||||
}
|
||||
if t == nil {
|
||||
typ.Null = true
|
||||
return typ
|
||||
}
|
||||
typ.Fields = []tdp.Field{
|
||||
{
|
||||
Name: "Peer",
|
||||
SchemaName: "peer",
|
||||
},
|
||||
{
|
||||
Name: "MsgID",
|
||||
SchemaName: "msg_id",
|
||||
},
|
||||
}
|
||||
return typ
|
||||
}
|
||||
|
||||
// Encode implements bin.Encoder.
|
||||
func (t *MessagesTranscribeAudioRequest) Encode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.transcribeAudio#269e9a49 as nil")
|
||||
}
|
||||
b.PutID(MessagesTranscribeAudioRequestTypeID)
|
||||
return t.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (t *MessagesTranscribeAudioRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't encode messages.transcribeAudio#269e9a49 as nil")
|
||||
}
|
||||
if t.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.transcribeAudio#269e9a49: field peer is nil")
|
||||
}
|
||||
if err := t.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.transcribeAudio#269e9a49: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(t.MsgID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (t *MessagesTranscribeAudioRequest) Decode(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.transcribeAudio#269e9a49 to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesTranscribeAudioRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.transcribeAudio#269e9a49: %w", err)
|
||||
}
|
||||
return t.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (t *MessagesTranscribeAudioRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if t == nil {
|
||||
return fmt.Errorf("can't decode messages.transcribeAudio#269e9a49 to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.transcribeAudio#269e9a49: field peer: %w", err)
|
||||
}
|
||||
t.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.transcribeAudio#269e9a49: field msg_id: %w", err)
|
||||
}
|
||||
t.MsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (t *MessagesTranscribeAudioRequest) GetPeer() (value InputPeerClass) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
return t.Peer
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (t *MessagesTranscribeAudioRequest) GetMsgID() (value int) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
return t.MsgID
|
||||
}
|
||||
|
||||
// MessagesTranscribeAudio invokes method messages.transcribeAudio#269e9a49 returning error if any.
|
||||
// Transcribe voice message¹
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/transcribe
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 400 PEER_ID_INVALID: The provided peer id is invalid.
|
||||
// 403 PREMIUM_ACCOUNT_REQUIRED: A premium account is required to execute this action.
|
||||
// 400 TRANSCRIPTION_FAILED: Audio transcription failed.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.transcribeAudio for reference.
|
||||
func (c *Client) MessagesTranscribeAudio(ctx context.Context, request *MessagesTranscribeAudioRequest) (*MessagesTranscribedAudio, error) {
|
||||
var result MessagesTranscribedAudio
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user