Enum tbot::types::bot_command::Scope
source · #[non_exhaustive]
pub enum Scope {
Default,
AllPrivateChats,
AllGroupChats,
AllChatAdministrators,
Chat(ChatId),
ChatAdministrators(ChatId),
ChatMember(ChatId, Id),
}
Expand description
A scope for which a list of bot commands is applied.
Represents BotCommandScope
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Default
The default scope, used when no narrower scope is specified.
AllPrivateChats
A scope for all private chats.
AllGroupChats
A scope for all group chats.
AllChatAdministrators
A scope for administrators of all chats.
Chat(ChatId)
A scope for a particular chat.
ChatAdministrators(ChatId)
A scope for administrators of a particular chat.
ChatMember(ChatId, Id)
A scope for a particular member of a specific chat.
Implementations§
source§impl Scope
impl Scope
sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true
if self
is of variant Default
.
sourcepub fn is_all_private_chats(&self) -> bool
pub fn is_all_private_chats(&self) -> bool
Returns true
if self
is of variant AllPrivateChats
.
sourcepub fn is_all_group_chats(&self) -> bool
pub fn is_all_group_chats(&self) -> bool
Returns true
if self
is of variant AllGroupChats
.
sourcepub fn is_all_chat_administrators(&self) -> bool
pub fn is_all_chat_administrators(&self) -> bool
Returns true
if self
is of variant AllChatAdministrators
.
sourcepub fn expect_chat(self) -> ChatIdwhere
Self: Debug,
pub fn expect_chat(self) -> ChatIdwhere
Self: Debug,
sourcepub fn chat(self) -> Option<ChatId>
pub fn chat(self) -> Option<ChatId>
Returns Some
if self
is of variant Chat
, and None
otherwise.
sourcepub fn is_chat_administrators(&self) -> bool
pub fn is_chat_administrators(&self) -> bool
Returns true
if self
is of variant ChatAdministrators
.
sourcepub fn expect_chat_administrators(self) -> ChatIdwhere
Self: Debug,
pub fn expect_chat_administrators(self) -> ChatIdwhere
Self: Debug,
Unwraps the value, yielding the content of ChatAdministrators
.
Panics
Panics if the value is not ChatAdministrators
, with a panic message including the content of self
.
sourcepub fn chat_administrators(self) -> Option<ChatId>
pub fn chat_administrators(self) -> Option<ChatId>
Returns Some
if self
is of variant ChatAdministrators
, and None
otherwise.
sourcepub fn is_chat_member(&self) -> bool
pub fn is_chat_member(&self) -> bool
Returns true
if self
is of variant ChatMember
.
sourcepub fn expect_chat_member(self) -> (ChatId, Id)where
Self: Debug,
pub fn expect_chat_member(self) -> (ChatId, Id)where
Self: Debug,
Unwraps the value, yielding the content of ChatMember
.
Panics
Panics if the value is not ChatMember
, with a panic message including the content of self
.
sourcepub fn chat_member(self) -> Option<(ChatId, Id)>
pub fn chat_member(self) -> Option<(ChatId, Id)>
Returns Some
if self
is of variant ChatMember
, and None
otherwise.
source§impl Scope
impl Scope
sourcepub const fn with_all_private_chats() -> Self
pub const fn with_all_private_chats() -> Self
Constructs a scope for all private chats.
sourcepub const fn with_all_group_chats() -> Self
pub const fn with_all_group_chats() -> Self
Constructs a scope for all group chats.
sourcepub const fn with_all_chat_administrators() -> Self
pub const fn with_all_chat_administrators() -> Self
Construct a scope for administrators of all chats.
sourcepub fn with_chat(chat_id: impl ImplicitChatId) -> Self
pub fn with_chat(chat_id: impl ImplicitChatId) -> Self
Constructs a scope for a particular chat.
sourcepub fn with_chat_administrators(chat_id: impl ImplicitChatId) -> Self
pub fn with_chat_administrators(chat_id: impl ImplicitChatId) -> Self
Constructs a scope for administrators of a particular chat.
sourcepub fn with_chat_member(chat_id: impl ImplicitChatId, user_id: Id) -> Self
pub fn with_chat_member(chat_id: impl ImplicitChatId, user_id: Id) -> Self
Constructs a scope for a particular member of the given chat.