#NEWLINE# @ group_only #NEWLINE# def get_random_quote( self , msg , matches ) : #NEWLINE# #INDENT# chat_id = msg . dest . id #NEWLINE# results = self . query ( 'SELECT * FROM {0} WHERE chat_id = {1} ORDER BY RANDOM() LIMIT 1' . format ( self . table_name , chat_id ) ) #NEWLINE# if ( len ( results ) == 0 ) : #NEWLINE# #INDENT# return 'No quotes in the database!' #NEWLINE# #UNINDENT# result = results [ 0 ] #NEWLINE# text = '{quote} ({qid} Added By {name} on {date})\n' . format ( quote = result [ 'quote' ] , name = result [ 'full_name' ] , date = datetime . strptime ( result [ 'timestamp' ] , '%Y-%m-%d %H:%M:%S' ) . date ( ) . isoformat ( ) , qid = result [ 'quote_id' ] ) #NEWLINE# return text