#🔒 need help with the userbot telegram
100 messages · Page 1 of 1 (latest)
@daring dove
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
What is the issue?
he is constantly adding the same users
Still haven't switched over to SQLite?
I used pymysql but it still seems to be a problem with the algorithm
Are you planning on using MySQL or SQLite?
MySQL
Seems like a bit much
but I think I can do without the database.
the script is not used all the time, so I think I can do without the database.
The whole point of the database is to restrict the data so it doesn't store duplicates
Unlike text files, you can store whatever
i get it
I tried using chat gpt, but it didn't do anything useful, but connected the database
Why don't you try with sqlite first?
And then if you wanna switch it to mysql, its a simple connection change
I've tried it now, but there are duplicates
show me
moment
you didn't set a unique constraint on the users table
Or you could set it as a primary key
And, I think you've set it in such a way that it constantly recreates the table. Tho then again, I think thats fine
I set username as uniq
I've fixed it now.
So it works?
full error message pls
moment
there are no errors, he duplicates the addition again
he checks the database, but there seems to be a problem with reading from the database
Please help me fix it
I haven't been able to fix it for 3 days
full error message pls
You could take it to the next level to ensure that it always works with sqlalchemy
it works without errors
everything works without errors
share your latest code
do you have something like sqlitebrowser or some other sqlite viewer to see what is contained in your not_added_users.sqlite3 file?
Can you open it and see if it did write into that database?
actually, should it be .sqlite3?

I think it should end in .db
who's he?
script*
Change the filenames in the script from .sqlite3 to .db
but it has not stopped being duplicated, it is duplicated not from the database side but from the script side
I dont understand. The database is already storing all of it uniquely. So it should be fine?
the database stores it, but the code starts working again from the first user
Please explain the problem in detail. Based on this sentence, it sounds like its working.
Have you looked at the code?
I looked. Its questionable but it looks fine
I have repeated users, i.e. he added 50 people, he adds the same 50 people again without switching to the following
he had to go through all the users but didn't get stuck on the same ones
you mean, you want it to stop when theres a duplicate?
Aren't usernames from Telegram unique by default?
there are no duplicates themselves, there is a repetition cycle that does not allow you to go to other users
I was talking about such duplicates
And is there another?
I wrote them to a file for the test and it repeated the entries, I meant duplicates.
duplicates?
you claim that user Faust_Gete_V is a duplicate
I only see one based on your screenshot
yes
here I did a word search and it showed 27 pieces
Without proof, I have no idea. But your SQL statements are inserting only unique users
ah ok
I see
OK so there are duplicates. You still havn't established what you wanna do if there are duplicates
I would like to understand why he constantly cycles using the same thing
can just use a loop when outputting from the database
I think this will help fix it.
Explain this line for me:
for app in apps.values(): # Iterate over each client
apps=[
Client("client1"),
Client("client2"),
......
}
I need all of them at once because I have 10 accounts to add users
Well, that explains why its repeatedly trying to insert the same users
Also this line doesn't make sense now:
filtered_users = users - added_users
Don't need it
K.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.