The Prophet ﷺ said, "When you hear roosters crowing, ask Allah of His bounty, for they have seen an angel. And when you hear a donkey braying, seek refuge in Allah from Satan, for it has seen a devil."
حدثنا قتيبة بن سعيد حدثنا الليث عن جعفر بن ربيعة عن الأعرج
أن النبي ﷺ قال إذا سمعتم صياح الديكة فاسألوا الله من فضله فإنها رأت ملكا وإذا سمعتم نهيق الحمار فتعوذوا بالله من الشيطان فإنه رأى شيطانا
Agreed upon [by Bukhari and Muslim]. Bukhari related it in the book of the Beginning of Creation, chapter on the best wealth of a Muslim being sheep that he takes to the mountain peaks, hadith no. 3303, and Muslim, hadith no. 2729, from Qutayba, with the same wording. Abu Dawud also related it, hadith no. 5102, and Nasai in Amal al-Yawm wal-Layla, hadith no. 944, from Qutayba, with the same wording.