Chat Member Management
Part of the API Reference.
banChatMember
Future<bool> banChatMember(
Object chatId,
int userId, {
int? untilDate,
bool? revokeMessages,
}) async =>
Bans a user from the chat. In supergroups/channels they won’t be able to return until unbanned; set [untilDate] for a temporary ban.
unbanChatMember
Future<bool> unbanChatMember(
Object chatId,
int userId, {
bool? onlyIfBanned,
}) async =>
Lifts a ban, allowing the user to rejoin. Set [onlyIfBanned] to avoid accidentally removing a user who is currently a member.
restrictChatMember
Future<bool> restrictChatMember(
Object chatId,
int userId,
ChatPermissions permissions, {
bool? useIndependentChatPermissions,
int? untilDate,
}) async =>
Restricts what a member can do in a supergroup via [permissions]
(e.g. mute them by disabling canSendMessages), optionally until [untilDate].
promoteChatMember
Future<bool> promoteChatMember(
Object chatId,
int userId, {
bool? isAnonymous,
bool? canManageChat,
bool? canDeleteMessages,
bool? canManageVideoChats,
bool? canRestrictMembers,
bool? canPromoteMembers,
bool? canChangeInfo,
bool? canInviteUsers,
bool? canPostStories,
bool? canEditStories,
bool? canDeleteStories,
bool? canPostMessages,
bool? canEditMessages,
bool? canPinMessages,
bool? canManageTopics,
}) async =>
Promotes or demotes a user to/from chat administrator, granting the specific admin privileges passed as named booleans.
setChatAdministratorCustomTitle
Future<bool> setChatAdministratorCustomTitle(Object chatId, int userId, String customTitle) async =>
Sets a custom title (shown instead of “Admin”) for an admin in a supergroup.
banChatSenderChat
Future<bool> banChatSenderChat(Object chatId, int senderChatId) async =>
Bans an anonymous channel (acting as a sender chat) from a group/channel.
unbanChatSenderChat
Future<bool> unbanChatSenderChat(Object chatId, int senderChatId) async =>
Unbans a previously banned sender chat.
setChatPermissions
Future<bool> setChatPermissions(
Object chatId,
ChatPermissions permissions, {
bool? useIndependentChatPermissions,
}) async =>
Sets the default [ChatPermissions] that apply to all non-admin members of a chat.