client: implement MuteHandlingNetworkAPI
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -78,6 +78,7 @@ var (
|
||||
_ bridgev2.ContactListingNetworkAPI = (*TelegramClient)(nil)
|
||||
_ bridgev2.UserSearchingNetworkAPI = (*TelegramClient)(nil)
|
||||
_ bridgev2.GroupCreatingNetworkAPI = (*TelegramClient)(nil)
|
||||
_ bridgev2.MuteHandlingNetworkAPI = (*TelegramClient)(nil)
|
||||
)
|
||||
|
||||
type UpdateDispatcher struct {
|
||||
|
||||
@@ -742,3 +742,17 @@ func (t *TelegramClient) onNotifySettings(ctx context.Context, update *tg.Update
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TelegramClient) HandleMute(ctx context.Context, msg *bridgev2.MatrixMute) error {
|
||||
inputPeer, err := t.inputPeerForPortalID(ctx, msg.Portal.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = t.client.API().AccountUpdateNotifySettings(ctx, &tg.AccountUpdateNotifySettingsRequest{
|
||||
Peer: &tg.InputNotifyPeer{Peer: inputPeer},
|
||||
Settings: tg.InputPeerNotifySettings{
|
||||
MuteUntil: int(msg.Content.GetMutedUntilTime().Unix()),
|
||||
},
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user