FlyWithMe

Untitled

Dec 2nd, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def random_phrases(subject, update):
  2.     chat_id = str(update.effective_chat.id)
  3.     sql_chat_id = chat_id.removeprefix('-')
  4.     in_db_num = int(subject)
  5.     query_user = f"SELECT phrases from chat_phrases where count_num = {in_db_num} and chat_id = {sql_chat_id} order by random() limit 1;"
  6.     cursor.execute(query_user)
  7.     query = cursor.fetchall()
  8.     subj = str(query)
  9.     fetch_query = (''.join([c for c in subj if c not in settings.chars_to_remove]))
  10.     return fetch_query
Advertisement
Add Comment
Please, Sign In to add comment