fix: add channel
This commit is contained in:
@@ -20,14 +20,16 @@ import (
|
||||
func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, cfg *DBChannel, onlyAddChannel bool) error {
|
||||
inputPeer := &tg.InputPeerChannel{ChannelID: channel.ID, AccessHash: channel.AccessHash}
|
||||
|
||||
limit := 50
|
||||
request := &tg.MessagesGetHistoryRequest{
|
||||
Peer: inputPeer,
|
||||
Limit: limit,
|
||||
Limit: 10,
|
||||
}
|
||||
|
||||
request.OffsetID = cfg.MinID + limit
|
||||
request.MinID = cfg.MinID
|
||||
if !onlyAddChannel {
|
||||
request.Limit = 50
|
||||
request.OffsetID = cfg.MinID + request.Limit
|
||||
request.MinID = cfg.MinID
|
||||
}
|
||||
|
||||
logger.Info("get channel message history", zap.Int("min_id", request.MinID), zap.Int("offset", request.OffsetID), zap.Int("limit", request.Limit))
|
||||
history, err := t.Client.API().MessagesGetHistory(ctx, request)
|
||||
|
||||
@@ -27,9 +27,7 @@ func ChannelAddCmd() *cobra.Command {
|
||||
defer log.Println("init client done")
|
||||
return InitClient(config.C)
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return channelAddCmd(context.Background())
|
||||
},
|
||||
RunE: wrapE(channelAddCmd),
|
||||
}
|
||||
cmd.Flags().Int64Var(&channelID, "channel", 0, "channel id")
|
||||
cmd.Flags().StringVar(&channelAlias, "alias", "", "channel alias")
|
||||
|
||||
Reference in New Issue
Block a user