示例#1
0
    def current_user(self) -> typing.Dict:
        """Implementation for the REST API query to get current user.

        Returns:
        typing.Dict: A dictionary object that will be used to parse the data
            into objects
        """
        data = fetch(
            BASE_URL + FETCH_CURRENT_USER,
            headers={"Authorization": f"{self.token_type} {self.token}"},
        )
        return data
示例#2
0
    def current_user_dms(self) -> typing.Dict:
        """Implementation for the REST API query to fetch current user's DMs list

        Returns:
        typing.Dict: A dictionary object that will be used to parse the data
            into objects
        """
        data = fetch(
            BASE_URL + DMS_LIST,
            headers={"Authorization": f"{self.token_type} {self.token}"},
        )
        return data
示例#3
0
    def user(self, snowflake: int) -> typing.Dict:
        """Interface for the REST API query to get user.

        Parameters:
        snowflake: int
                The channel ID of a Discord channel

        Returns:
        typing.Dict: A dictionary object that will be used to parse the data
            into objects
        """
        data = fetch(
            BASE_URL + FETCH_USER.format(snowflake),
            headers={"Authorization": f"{self.token_type} {self.token}"},
        )
        return data
示例#4
0
    def channel(self, snowflake: int) -> typing.Dict:
        """Implementation for the REST API query to get channels.

        Parameters:
        snowflake: int
                The channel ID of a Discord channel

        Returns:
        typing.Dict: A dictionary object that will be used to parse the data
            into objects
        """
        data = fetch(
            BASE_URL + FETCH_CHANNEL.format(snowflake),
            headers={"Authorization": f"{self.token_type} {self.token}"},
        )
        error_checker(data)
        return data