Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.
Schema:
peerSettings#a518110d flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int = PeerSettings;
userFull#b9b12c6c flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?PeerStories = UserFull;
updatePeerSettings#6a7e7366 peer:Peer settings:PeerSettings = Update;
messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Vector<User> = messages.PeerSettings;
---functions---
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool;
The action bar is represented by the peerSettings constructor, fetchable using messages.getPeerSettings; it is also contained in the userFull constructor returned by users.getFullUser.
Changes to the chat bar may also be notified by the server using updatePeerSettings.
The currently active action bar may also be dismissed using messages.hidePeerSettingsBar.
What follows is a list of the various (mutually exclusive) chat bar types, along with the condition used to identify each type, by checking the appropriate flags of peerSettings.
inputReportReasonSpam#58dbcab8 = ReportReason;
---functions---
account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;
contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
contacts.block#2e2e8734 flags:# my_stories_from:flags.0?true id:InputPeer = Bool;
This action bar, associated to a private or secret chat, offers the user buttons to:
autoarchived
), an extra button can be shown to unarchive the chat as specified here » instead of reporting it.need_contacts_exception
flag may also be set: if so, the add_phone_privacy_exception
flag must be set if the user clicks on the add contact button, invoking contacts.addContact. my_stories_from
flag). Condition: the peerSettings.report_spam
, peerSettings.add_contact
, peerSettings.block_contact
flags must all be set.
Additionally, if the peerSettings.geo_distance
flag is set, the bar should also display the distance between us and the user, indicating that the user found us by invoking contacts.getLocated, because we are currently advertising our location with the same method.
inputReportReasonSpam#58dbcab8 = ReportReason;
---functions---
account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;
This action bar, associated to a private or secret chat, offers the user a button to report the chat for spam using account.reportPeer and inputReportReasonSpam.
If the other user has an emoji status, then the bar should also show a notice, indicating that the emoji status is shown next to the user's name because they have purchased Telegram Premium (i.e. this is useful to avoid issues if the user uses an emoji status similar to a verified checkmark).
Condition: the peerSettings.report_spam
flag must be set, and the peerSettings.add_contact
, peerSettings.block_contact
flags must not be set.
Additionally, if the chat was automatically archived » (according to peerSettings.autoarchived
), an extra button can be shown to unarchive the chat as specified here » instead of reporting it.
---functions---
contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
This action bar, associated to a private or secret chat, offers the user a button to add the other user of the chat to the contact list using contacts.addContact.
Conditions: the peerSettings.add_contact
flag must be set and:
block_contact
and report_spam
flags must not be set.Optionally, the peerSettings.need_contacts_exception
flag may also be set: if so, the add_phone_privacy_exception
flag must be set if the user clicks on the add contact button, invoking contacts.addContact.
---functions---
contacts.acceptContact#f831a20f id:InputUser = Updates;
This action bar, associated to a private or secret chat, offers the user a button to share their phone number with the other user using contacts.acceptContact.
Condition: the peerSettings.share_contact
flag must be set.
This flag is set and the bar is activated only if the other user has added us as a contact using contacts.addContact, without using a phone number, and none of the add_contact
, report_spam
, block_contact
flags are set.
inputReportReasonGeoIrrelevant#dbd4feed = ReportReason;
---functions---
account.reportPeer#c5ba3d86 peer:InputPeer reason:ReportReason message:string = Bool;
This bar indicates that the associated location-based supergroup can be reported for having an unrelated location using a bar button that invokes account.reportPeer with reason
inputReportReasonGeoIrrelevant.
Condition: the peerSettings.report_geo
flag must be set.
---functions---
messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Updates;
channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;
This bar indicates that the associated group was created recently, and it offers a bar button to invite new members using messages.addChatUser or channels.inviteToChannel, depending on whether the associated peer is a group or a supergroup.
Condition: the peerSettings.invite_members
flag must be set.
This bar indicates that the associated private or secret chat is a chat with an administrator of a group or channel to which the user sent a join request, see here for more info on join requests ».
Condition: the request_chat_title
and request_chat_date
fields of peerSettings must both be set; optionally request_chat_broadcast
may also be set:
request_chat_title
- Contains the group/channel's title.request_chat_date
- Contains the timestamp indicating when the join request was sent.request_chat_broadcast
- This flag is set if the join request is related to a channel (otherwise, the join request is related to a group).