Answer the question
In order to leave comments, you need to log in
TypeError: function takes at most 2 arguments (3 given) how to fix?
I create a base for id and file_id but an error occurred, the base was created, but the id and file_id are empty there, although I pressed start in the bot and had to write down my telegram id.
import sqlite3
from sqlite3 import connect
import cursor as cursor
import telebot
API_TOKEN = 'moy_token'
bot = telebot.TeleBot(API_TOKEN)
@bot.message_handler(commands=['start'])
def start(message):
connect = sqlite3.connect('users.db')
cursor = connect.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS username_id(
id INTEGER,
file_id INTEGER
)""")
connect.commit()
user_id = ["message.chat.id"]
file_id = ["message.photo.file_id"]
cursor.execute("INSERT INTO username_id VALUES(?,?);",user_id, file_id)
connect.commit()
bot.infinity_polling()
cursor.execute("INSERT INTO username_id VALUES(?,?);",user_id, file_id)
TypeError: function takes at most 2 arguments (3 given)
Мне писали, что нужно MediaGroup и как к file_id это прописать.
Answer the question
In order to leave comments, you need to log in
cursor.execute("INSERT INTO username_id VALUES(?,?);",(user_id, file_id))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question