db which one is correct
query_insert_users_settings = (
f"INSERT OR IGNORE INTO users_settings\
(chat_id, {query_insert_users_settings_str_fields}) \
VALUES (?, {query_insert_users_settings_str_input})"
)
or
query_insert_users_settings = (
f"INSERT OR IGNORE INTO users_settings\
(chat_id, {query_insert_or_ignore_users_settings_str_fields}) \
VALUES (?, {query_insert_users_settings_str_input})"
)
This is not really related to bot development
I am saving users id to my db
You can just ignore it, let the admins decide what to do
I have a unity game that can be controller from Telegram bot. That doesn't mean I should ask unity questions here
Our questions are completely different
Can anyone help?
Tip: ChatGPT can help you for small doubts like this one and save time 😉
It's not available in my country
Neither in mine, vpn helps
What do you want to insert and into which columns? Because I can see the first col chat_id, but the second column is not clear to me
That's what I was talking about: feels like second column is just being placed from a variable, which name he can't choose
This is the general syntax, you can modify according to your needs: - Using F-Strings: table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = f"INSERT OR IGNORE INTO {table_name} (column1, column2) VALUES ('{column1}', '{column2}')" - Using the % formatting: table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = "INSERT OR IGNORE INTO %s (column1, column2) VALUES ('%s', '%s')" % (table_name, column1, column2) - Paramentrized (?) Queries (works for SQLite, use the above methods for MySQL): import sqlite3 conn = sqlite3.connect('your_database.db') cursor = conn.cursor() table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = "INSERT OR IGNORE INTO {} (column1, column2) VALUES (?, ?)".format(table_name) # values need to be a tuple cursor.execute(sql_query, (column1, column2)) conn.commit() conn.close()
Its the same but sometimes i get issues when users just send message instead of using /start and then uses /start command (i think this is the issue), and the database gets locked after so i want to know which one is correct to ignore if users is already available on db
Are you using SQLite? In my experience, SQLite tends to get db locks more frequently than MySQL
10 prompts / day on the free plan
restriction is for normal users, it can be easily bypassed xD
It is way easier to get openai account rather than bypassing anything
you're in a normal person's list & it's nice but you can't feel how pentesters enjoy their work at that moment to bypass something
So here normal user is asking for help not pentester.
Обсуждают сегодня