The Prophet ﷺ said, "Whoever sees me in a dream has truly seen me, for Satan cannot take my form. The dream of a believer is one of forty-six parts of prophethood."In another wording, "A good dream from a righteous man is one of forty-six parts of prophethood."
قال النبي ﷺ: من رآني في المنام فقد رآني، فإن الشيطان لا يتمثل بي، ورؤيا المؤمن جزء من ستة وأربعين جزءا من النبوة وفي لفظ: الرؤيا الحسنة من الرجل الصالح جزء من ستة وأربعين جزءا من النبوة
Bukhari narrated it in the Book of Dream Interpretation (6994) through Abdul-Aziz bin Mukhtar, from Thabit Bunani, from Anas, and he related it with the first wording. Muslim narrated it in the Book of Dreams (7:2264) through Shuba, from Thabit, from him, except that he did not mention its wording, but instead referred back to the hadith of Ubadah before it, and there is no mention in the hadith of Ubadah of the Prophet ﷺ seeing a dream in his sleep. Bukhari narrated it in the Book of Dream Interpretation (6983) through Malik (and it is in the Muwatta, 1), from Ishaq bin Abdullah bin Abu Talha, from Anas, and he related it with the second wording.