telegram-api-0.7.1.0: Telegram Bot API bindings

Safe HaskellNone
LanguageHaskell2010

Web.Telegram.API.Bot.API.Chats

Contents

Synopsis

Functions

kickChatMember Source #

Arguments

:: Token 
-> Text

Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)

-> Int

Unique identifier of the target user

-> Manager 
-> IO (Either ServantError KickChatMemberResponse) 

Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work.

kickChatMemberUntilM Source #

Arguments

:: Text

Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)

-> Int

Unique identifier of the target user

-> Int

Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever

-> TelegramClient KickChatMemberResponse 

leaveChat :: Token -> Text -> Manager -> IO (Either ServantError LeaveChatResponse) Source #

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

unbanChatMember :: Token -> Text -> Int -> Manager -> IO (Either ServantError UnbanChatMemberResponse) Source #

Use this method to unban a previously kicked user in a supergroup. The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work.

restrictChatMemberM :: RestrictChatMemberRequest -> TelegramClient (Response Bool) Source #

Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success.

promoteChatMemberM :: PromoteChatMemberRequest -> TelegramClient (Response Bool) Source #

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.

exportChatInviteLinkM :: Text -> TelegramClient (Response Text) Source #

Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.

setChatPhotoM :: SetChatPhotoRequest -> TelegramClient (Response Bool) Source #

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

deleteChatPhotoM :: Text -> TelegramClient (Response Bool) Source #

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

setChatTitleM :: Text -> Maybe Text -> TelegramClient (Response Bool) Source #

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

setChatDescriptionM :: Text -> Maybe Text -> TelegramClient (Response Bool) Source #

Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

pinChatMessageM :: Text -> Int -> Maybe Bool -> TelegramClient (Response Bool) Source #

Use this method to pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the can_pin_messages admin right in the supergroup or can_edit_messages admin right in the channel. Returns True on success.

unpinChatMessageM :: Text -> TelegramClient (Response Bool) Source #

Use this method to unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the can_pin_messages admin right in the supergroup or can_edit_messages admin right in the channel. Returns True on success.

getChat :: Token -> Text -> Manager -> IO (Either ServantError GetChatResponse) Source #

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.)

getChatAdministrators :: Token -> Text -> Manager -> IO (Either ServantError GetChatAdministratorsResponse) Source #

Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.

getChatMembersCount :: Token -> Text -> Manager -> IO (Either ServantError GetChatMembersCountResponse) Source #

Use this method to get the number of members in a chat. Returns Int on success.

getChatMember :: Token -> Text -> Int -> Manager -> IO (Either ServantError GetChatMemberResponse) Source #

Use this method to get information about a member of a chat. Returns a ChatMember object on success.

setChatStickerSetM Source #

Arguments

:: Text

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

-> Text

Name of the sticker set to be set as the group sticker set

-> TelegramClient (Response Bool) 

deleteChatStickerSetM Source #

Arguments

:: Text

Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

-> TelegramClient (Response Bool) 

API

type TelegramBotChatsAPI = (TelegramToken :> ("kickChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> (QueryParam "until_date" Int :> Post '[JSON] KickChatMemberResponse))))) :<|> ((TelegramToken :> ("leaveChat" :> (QueryParam "chat_id" Text :> Post '[JSON] LeaveChatResponse))) :<|> ((TelegramToken :> ("unbanChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> Post '[JSON] UnbanChatMemberResponse)))) :<|> ((TelegramToken :> ("restrictChatMember" :> (ReqBody '[JSON] RestrictChatMemberRequest :> Post '[JSON] (Response Bool)))) :<|> ((TelegramToken :> ("promoteChatMember" :> (ReqBody '[JSON] PromoteChatMemberRequest :> Post '[JSON] (Response Bool)))) :<|> ((TelegramToken :> ("exportChatInviteLink" :> (QueryParam "chat_id" Text :> Post '[JSON] (Response Text)))) :<|> ((TelegramToken :> ("setChatPhoto" :> (MultipartFormDataReqBody SetChatPhotoRequest :> Post '[JSON] (Response Bool)))) :<|> ((TelegramToken :> ("deleteChatPhoto" :> (QueryParam "chat_id" Text :> Post '[JSON] (Response Bool)))) :<|> ((TelegramToken :> ("setChatTitle" :> (QueryParam "chat_id" Text :> (QueryParam "title" Text :> Post '[JSON] (Response Bool))))) :<|> ((TelegramToken :> ("setChatDescription" :> (QueryParam "chat_id" Text :> (QueryParam "description" Text :> Post '[JSON] (Response Bool))))) :<|> ((TelegramToken :> ("pinChatMessage" :> (QueryParam "chat_id" Text :> (QueryParam "message_id" Int :> (QueryParam "disable_notification" Bool :> Post '[JSON] (Response Bool)))))) :<|> ((TelegramToken :> ("unpinChatMessage" :> (QueryParam "chat_id" Text :> Post '[JSON] (Response Bool)))) :<|> ((TelegramToken :> ("getChat" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatResponse))) :<|> ((TelegramToken :> ("getChatAdministrators" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatAdministratorsResponse))) :<|> ((TelegramToken :> ("getChatMembersCount" :> (QueryParam "chat_id" Text :> Post '[JSON] GetChatMembersCountResponse))) :<|> ((TelegramToken :> ("getChatMember" :> (QueryParam "chat_id" Text :> (QueryParam "user_id" Int :> Post '[JSON] GetChatMemberResponse)))) :<|> ((TelegramToken :> ("setChatStickerSet" :> (QueryParam "chat_id" Text :> (QueryParam "sticker_set_name" Text :> Post '[JSON] (Response Bool))))) :<|> (TelegramToken :> ("deleteChatStickerSet" :> (QueryParam "chat_id" Text :> Post '[JSON] (Response Bool)))))))))))))))))))) Source #

Telegram Bot API

chatsApi :: Proxy TelegramBotChatsAPI Source #

Proxy for Thelegram Bot API to administrate chats