ptgc
MTProto client for Dart

Permissions & Rights

Part of the API Reference. Two typed permission sets used by Member Management in place of Telegram’s raw boolean-flag grab bags.

AdminRights

Which admin privileges a member has, for Members.promote.

Every field defaults to false; turn on only what you mean to grant. Use AdminRights.full() as a shortcut for “give every right” and adjust from there with copyWith. AdminRights.none() is the counterpart, used internally by Members.demote.

const AdminRights({
  this.changeInfo = false,
  this.postMessages = false,
  this.editMessages = false,
  this.deleteMessages = false,
  this.banUsers = false,
  this.inviteUsers = false,
  this.pinMessages = false,
  this.addAdmins = false,
  this.anonymous = false,
  this.manageCall = false,
  this.other = false,
  this.manageTopics = false,
});
Field Meaning
changeInfo Can edit the chat’s title, photo, and other info.
postMessages Can post messages (channels only).
editMessages Can edit other members’ messages (channels only).
deleteMessages Can delete other members’ messages.
banUsers Can ban/kick/restrict other members.
inviteUsers Can invite new members (needed even for public groups, to generate invite links).
pinMessages Can pin messages.
addAdmins Can appoint new admins with a subset of their own rights.
anonymous Appears as “anonymous admin” — messages are signed by the group, not the account.
manageCall Can start/manage group calls and live streams.
other Catch-all for miscellaneous rights not covered above.
manageTopics Can create, rename, and manage forum topics.

Named constructors: AdminRights.full(), AdminRights.none(). Instance method: copyWith({...}).

BannedRights

Which actions a member is forbidden from taking, for Members.restrict, Members.ban, Members.kick, and Members.unban.

Every field defaults to false (i.e. “not restricted”). This mirrors Telegram’s own ChatBannedRights — turning a field on takes that permission away. Prefer the named constructors ([BannedRights.banned], [BannedRights.none]) over constructing this directly unless you need fine-grained control — see Fine-Grained Restrictions.

const BannedRights({
  this.viewMessages = false,
  this.sendMessages = false,
  this.sendMedia = false,
  this.sendStickers = false,
  this.sendGifs = false,
  this.sendGames = false,
  this.sendInline = false,
  this.embedLinks = false,
  this.sendPolls = false,
  this.changeInfo = false,
  this.inviteUsers = false,
  this.pinMessages = false,
  this.manageTopics = false,
  this.sendPhotos = false,
  this.sendVideos = false,
  this.sendRoundvideos = false,
  this.sendAudios = false,
  this.sendVoices = false,
  this.sendDocs = false,
  this.sendPlain = false,
  this.sendReactions = false,
  this.until,
});

viewMessages is what makes a restriction a full ban/kick rather than a mute — it’s the only field BannedRights.banned() and a typical mute-only restriction disagree on. until is a DateTime? for when the restriction lifts (null means forever); Telegram treats anything under 30 seconds or over 366 days as permanent.

BannedRights.banned({DateTime? until})

A full ban: every field set to true. The member can no longer view or interact with the chat at all. See Permanent & Temporary Bans.

BannedRights.none()

No restrictions — lifts a ban or mute entirely.