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,224 @@
|
||||
// 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{}
|
||||
)
|
||||
|
||||
// MessagesDeleteFactCheckRequest represents TL type `messages.deleteFactCheck#d1da940c`.
|
||||
// Delete a fact-check¹ from a message.
|
||||
// Can only be used by independent fact-checkers as specified by the appConfig
|
||||
// can_edit_factcheck¹ configuration flag.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/factcheck
|
||||
// 2. https://core.telegram.org/api/config#can-edit-factcheck
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.deleteFactCheck for reference.
|
||||
type MessagesDeleteFactCheckRequest struct {
|
||||
// Peer where the message was sent.
|
||||
Peer InputPeerClass
|
||||
// Message ID
|
||||
MsgID int
|
||||
}
|
||||
|
||||
// MessagesDeleteFactCheckRequestTypeID is TL type id of MessagesDeleteFactCheckRequest.
|
||||
const MessagesDeleteFactCheckRequestTypeID = 0xd1da940c
|
||||
|
||||
// Ensuring interfaces in compile-time for MessagesDeleteFactCheckRequest.
|
||||
var (
|
||||
_ bin.Encoder = &MessagesDeleteFactCheckRequest{}
|
||||
_ bin.Decoder = &MessagesDeleteFactCheckRequest{}
|
||||
_ bin.BareEncoder = &MessagesDeleteFactCheckRequest{}
|
||||
_ bin.BareDecoder = &MessagesDeleteFactCheckRequest{}
|
||||
)
|
||||
|
||||
func (d *MessagesDeleteFactCheckRequest) Zero() bool {
|
||||
if d == nil {
|
||||
return true
|
||||
}
|
||||
if !(d.Peer == nil) {
|
||||
return false
|
||||
}
|
||||
if !(d.MsgID == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (d *MessagesDeleteFactCheckRequest) String() string {
|
||||
if d == nil {
|
||||
return "MessagesDeleteFactCheckRequest(nil)"
|
||||
}
|
||||
type Alias MessagesDeleteFactCheckRequest
|
||||
return fmt.Sprintf("MessagesDeleteFactCheckRequest%+v", Alias(*d))
|
||||
}
|
||||
|
||||
// FillFrom fills MessagesDeleteFactCheckRequest from given interface.
|
||||
func (d *MessagesDeleteFactCheckRequest) FillFrom(from interface {
|
||||
GetPeer() (value InputPeerClass)
|
||||
GetMsgID() (value int)
|
||||
}) {
|
||||
d.Peer = from.GetPeer()
|
||||
d.MsgID = from.GetMsgID()
|
||||
}
|
||||
|
||||
// TypeID returns type id in TL schema.
|
||||
//
|
||||
// See https://core.telegram.org/mtproto/TL-tl#remarks.
|
||||
func (*MessagesDeleteFactCheckRequest) TypeID() uint32 {
|
||||
return MessagesDeleteFactCheckRequestTypeID
|
||||
}
|
||||
|
||||
// TypeName returns name of type in TL schema.
|
||||
func (*MessagesDeleteFactCheckRequest) TypeName() string {
|
||||
return "messages.deleteFactCheck"
|
||||
}
|
||||
|
||||
// TypeInfo returns info about TL type.
|
||||
func (d *MessagesDeleteFactCheckRequest) TypeInfo() tdp.Type {
|
||||
typ := tdp.Type{
|
||||
Name: "messages.deleteFactCheck",
|
||||
ID: MessagesDeleteFactCheckRequestTypeID,
|
||||
}
|
||||
if d == 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 (d *MessagesDeleteFactCheckRequest) Encode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.deleteFactCheck#d1da940c as nil")
|
||||
}
|
||||
b.PutID(MessagesDeleteFactCheckRequestTypeID)
|
||||
return d.EncodeBare(b)
|
||||
}
|
||||
|
||||
// EncodeBare implements bin.BareEncoder.
|
||||
func (d *MessagesDeleteFactCheckRequest) EncodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't encode messages.deleteFactCheck#d1da940c as nil")
|
||||
}
|
||||
if d.Peer == nil {
|
||||
return fmt.Errorf("unable to encode messages.deleteFactCheck#d1da940c: field peer is nil")
|
||||
}
|
||||
if err := d.Peer.Encode(b); err != nil {
|
||||
return fmt.Errorf("unable to encode messages.deleteFactCheck#d1da940c: field peer: %w", err)
|
||||
}
|
||||
b.PutInt(d.MsgID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decode implements bin.Decoder.
|
||||
func (d *MessagesDeleteFactCheckRequest) Decode(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.deleteFactCheck#d1da940c to nil")
|
||||
}
|
||||
if err := b.ConsumeID(MessagesDeleteFactCheckRequestTypeID); err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deleteFactCheck#d1da940c: %w", err)
|
||||
}
|
||||
return d.DecodeBare(b)
|
||||
}
|
||||
|
||||
// DecodeBare implements bin.BareDecoder.
|
||||
func (d *MessagesDeleteFactCheckRequest) DecodeBare(b *bin.Buffer) error {
|
||||
if d == nil {
|
||||
return fmt.Errorf("can't decode messages.deleteFactCheck#d1da940c to nil")
|
||||
}
|
||||
{
|
||||
value, err := DecodeInputPeer(b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deleteFactCheck#d1da940c: field peer: %w", err)
|
||||
}
|
||||
d.Peer = value
|
||||
}
|
||||
{
|
||||
value, err := b.Int()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode messages.deleteFactCheck#d1da940c: field msg_id: %w", err)
|
||||
}
|
||||
d.MsgID = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPeer returns value of Peer field.
|
||||
func (d *MessagesDeleteFactCheckRequest) GetPeer() (value InputPeerClass) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.Peer
|
||||
}
|
||||
|
||||
// GetMsgID returns value of MsgID field.
|
||||
func (d *MessagesDeleteFactCheckRequest) GetMsgID() (value int) {
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
return d.MsgID
|
||||
}
|
||||
|
||||
// MessagesDeleteFactCheck invokes method messages.deleteFactCheck#d1da940c returning error if any.
|
||||
// Delete a fact-check¹ from a message.
|
||||
// Can only be used by independent fact-checkers as specified by the appConfig
|
||||
// can_edit_factcheck¹ configuration flag.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/factcheck
|
||||
// 2. https://core.telegram.org/api/config#can-edit-factcheck
|
||||
//
|
||||
// Possible errors:
|
||||
//
|
||||
// 403 CHAT_ACTION_FORBIDDEN: You cannot execute this action.
|
||||
// 400 PEER_ID_INVALID: The provided peer id is invalid.
|
||||
//
|
||||
// See https://core.telegram.org/method/messages.deleteFactCheck for reference.
|
||||
func (c *Client) MessagesDeleteFactCheck(ctx context.Context, request *MessagesDeleteFactCheckRequest) (UpdatesClass, error) {
|
||||
var result UpdatesBox
|
||||
|
||||
if err := c.rpc.Invoke(ctx, request, &result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Updates, nil
|
||||
}
|
||||
Reference in New Issue
Block a user