[Machine] The Messenger of Allah ﷺ said, "There is no man who is sitting in a gathering and says, when he intends to leave it, 'Subhanaka Allahumma wa bihamdika, la ilaha illa anta, astaghfiruka wa atubu ilaik' (Glory and praise be to You, O Allah, there is no deity worthy of worship except You. I seek forgiveness from You and repent unto You), except that he will be forgiven for what occurred in that gathering." I narrated this hadith to Yazid ibn Khusaifah, who said that Saib ibn Yazid (may Allah be pleased with him) narrated to him from the Messenger of Allah ﷺ in the same way.
أَنَّ رَسُولَ اللهِ ﷺ قَالَ مَا مِنْ إِنْسَانٍ يَكُونُ فِي مَجْلِسٍ فَيَقُولُ حِينَ يُرِيدُ أَنْ يَقُومَ سُبْحَانَكَ اللهُمَّ وَبِحَمْدِكَ لَا إِلَهَ إِلَّا أَنْتَ أَسْتَغْفِرُكَ وَأَتُوبُ إِلَيْكَ إِلَّا غُفِرَ لَهُ مَا كَانَ فِي ذَلِكَ الْمَجْلِسِ فَحَدَّثْتُ بِهَذَا الْحَدِيثِ يَزِيدَ بْنَ خُصَيْفَةَ فَقَالَ هَكَذَا حَدَّثَنِي السَّائِبُ بْنُ يَزِيدَ عَنْ رَسُولِ اللهِ ﷺ