通知铃声

电报 API 允许上传和同步与特定聊天关联的通知声音。

上传通知声音

模式:

account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones;updateSavedRingtones#74d8be99 = Update;account.savedRingtone#b7263f6d = account.SavedRingtone; account.savedRingtoneConverted#1f307eb7 document:Document = account.SavedRingtone;---functions---account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document; account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone; account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones;

可以使用account.uploadRingtone上传通知音文件。
上传后,应将该文档提供给account.saveRingtone以保存通知音,并返回一个简单的account.savedRingtone。

支持的格式:

也可以直接将现有的语音消息传递给account.saveRingtone。
当将现有的语音消息传递给account.saveRingtone时,会返回一个account.savedRingtoneConverted构造函数,其中包含一个新文档,用于在移除或使用通知声音时替换原始语音消息文档。

客户端配置中指定了以下铃声限制:

移除通知音

模式:

account.savedRingtone#b7263f6d = account.SavedRingtone;---functions---account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone;

将account.saveRingtoneunsave中的true 值传递给它,即可移除已上传的通知声音。

收到通知声音

模式:

updateSavedRingtones#74d8be99 = Update;account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones; account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones;---functions---account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones;

account.getSavedRingtones可用于获取所有已保存的通知铃声。如果用户在其他客户端上修改了铃声列表,
客户端将收到updateSavedRingtones更新,这将触发对account.getSavedRingtones 的调用。

设置通知声音

模式:

notificationSoundDefault#97e8bebe = NotificationSound; notificationSoundNone#6f0c34df = NotificationSound; notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound; notificationSoundRingtone#ff6c8049 id:long = NotificationSound;inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_sound:flags.8?NotificationSound = InputPeerNotifySettings;---functions---account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool;

要设置接收来自特定对等方或某类对等方的消息时播放的通知声音,请使用account.updateNotifySettings,根据要播放声音的平台填充ios_sound、android_sound或字段。other_sound

可以使用以下构造函数填充字段: