示例#1
0
        /// <summary>
        /// Gets the total number of members in a chat. Result<int> object on success.
        /// </summary>
        /// <param name="chat_id">The Id number of the chat to get info for. Can be a Channel Or group. Cannot be a bot or User.</param>
        /// <returns></returns>
        public static Result <int> getChatMembersCount(long chat_id)
        {
            GetChatRequest gcr = new GetChatRequest()
            {
                chat_id = chat_id
            };
            Result <int> result = null;

            result = sendRequest <int>(Method.getChatMembersCount, buildRequest <GetChatRequest>(gcr));
            return(result);
        }
示例#2
0
        /// <summary>
        /// Force the bot to leave the specified Channel or Group. Result<bool> object that equals true on success.
        /// </summary>
        /// <param name="chat_id">The Id number of the chat to force the bot to leave. Can be a Channel Or group. Cannot be a bot or User.</param>
        /// <returns></returns>
        public static Result <bool> leaveChat(long chat_id)
        {
            GetChatRequest gcr = new GetChatRequest()
            {
                chat_id = chat_id
            };
            Result <bool> result = null;

            result = sendRequest <bool>(Method.leaveChat, buildRequest <GetChatRequest>(gcr));
            return(result);
        }
示例#3
0
        /// <summary>
        /// Gets an array of ChatMember[] which contains the list of permissions for each Member. Result<ChatMember> object on success.
        /// </summary>
        /// <param name="chat_id">The Id number of the chat to get info for. Can be a Channel Or group. Cannot be a bot or User.</param>
        /// <returns></returns>
        public static Result <ChatMember[]> getChatAdministrators(long chat_id)
        {
            GetChatRequest gcr = new GetChatRequest()
            {
                chat_id = chat_id
            };
            Result <ChatMember[]> result = null;

            result = sendRequest <ChatMember[]>(Method.getChatAdministrators, buildRequest <GetChatRequest>(gcr));
            return(result);
        }
示例#4
0
        /// <summary>
        /// Generates a new Invitelink and returns it on success.
        /// </summary>
        /// <param name="chat_id">The Id number of the chat get the invite from. Can be a Channel Or group. Cannot be a bot or User.</param>
        /// <returns></returns>
        public static Result <string> exportChatInviteLink(long chat_id)
        {
            GetChatRequest gcr = new GetChatRequest()
            {
                chat_id = chat_id
            };
            Result <string> result = null;

            result = sendRequest <string>(Method.exportChatInviteLink, buildRequest <KickChatMemberRequest>(gcr));
            return(result);
        }