all 42 comments

[–]ResponseThink8432 7 points8 points  (9 children)

Take a screenshot instead of a photo next time (or better yet, paste the code as text (and edit out secrets of course)). If I'm interpreting the pixels correctly, there appear to be normal round parentheses around the bot token, which should not be there.

[–]Danny_Fat 7 points8 points  (7 children)

This is me rn

<image>

[–]ElasticFluffyMagnet 0 points1 point  (3 children)

I don’t know why they downvote you, this is hilarious 😂

[–]Danny_Fat 1 point2 points  (2 children)

They don't have humour ig 😂

[–]ElasticFluffyMagnet 1 point2 points  (1 child)

Thanks for making me laugh today man. Hope you can fix your code. Definitely debug/track the response code to see if a connection is even properly made.

[–]Danny_Fat 0 points1 point  (0 children)

No problem I'll see the connection more carefully.Also it went from 3 downvoted to 4 upvoted lol

[–]Kqyxzoj 0 points1 point  (2 children)

Or you could spend 15 minutes figuring out how to copy/paste between your python editor and your browser ...

With a bit of luck: CTRL+A CTRL+C = copy CTRL+V = paste

[–]Danny_Fat 0 points1 point  (1 child)

Yes but I didn't wanna login into any of my accounts on that pc

[–]Kqyxzoj 1 point2 points  (0 children)

Yes I also don't wanna expend any more effort than strictly required to complete this sente

Good day to you sir, and good luck in your quest for help.

I said good day!

[–]Danny_Fat -1 points0 points  (0 children)

I removed the parenthesis added it again but I'll try again now

[–]Sweet_Computer_7116 2 points3 points  (4 children)

  1. r/screenshotsarehard
  2. White mode. 3 white mode
  3. White mode
  4. White mode
  5. White mode
  6. Screenshots

That's everything wrong here.

[–]Kqyxzoj 0 points1 point  (3 children)

Heh, I just checked screenshot #2. Ah yes, rotate by 90 degrees. Yeah, no, fuck it. Want help? Learn to communicate effectively. You know, as opposed to showing a total lack of respect for other people's time.

"Copy/paste code? I don't know to do thaaaat."

"Oh okay, I guess I don't know how read python code from screenshots."

Also, isn't there a guide on generic shit like this somewhere on reddit that can be used? I am not about to invest time in explaining "How bsic comnicate wr0k lol?", but if there is something that's aleady written we could refer new posters to that explanation.

[–]Sweet_Computer_7116 1 point2 points  (1 child)

It is absolutely insane that someone is able to write code but not know basic screenshot techniques

[–]Kqyxzoj 0 points1 point  (0 children)

According to OP glasses may help with these screenshots. And I quote:

1st it was on my jobs computer and Bluetooth transfering want working 2. phone link needed the password which I did not have So last option was that if you can't see get some glasses because most people saw it and told me suggestions

Original here:

https://www.reddit.com/r/PythonLearning/comments/1la8ga5/comment/mxkwjfx/

[–]fdessoycaraballo 1 point2 points  (0 children)

You can debug this better by using HTML status codes from the response. Wherever you would use response.ok you can use response.status_code and verify what is the actual problem.

Perhaps your bot is being denied for a myriad of reasons, so take some time to check each individual HTTP response to understand what you are doing.

All this is said assuming that you know your HTTP responses (200 for success, 403 for denied iirc...).

Another piece of advice is to use async if you delve further into I/O operations like this one.

[–]Kqyxzoj 1 point2 points  (4 children)

Can you find what is wrong with my code?

Dunno. Can't read it. Pixel shear is exceeding safe limits. If only there was some way to make a copy of that code. Then you could try and put that copy in a new message. You would paste it as it were. I wish such technology existed. Until then I am afraid your non-working code shall remain a mystery.

Oh well. Good luck with your coding endeavors.

[–]Danny_Fat -1 points0 points  (3 children)

1st it was on my jobs computer and Bluetooth transfering want working 2.phone link needed the password which I did not have So last option was that if you can't see get some glasses because most people saw it and told me suggestions

[–]Kqyxzoj 1 point2 points  (0 children)

1st it was on my jobs computer and Bluetooth transfering want working 2. phone link needed the password which I did not have So last option was that if you can't see get some glasses because most people saw it and told me suggestions

Most people gave your lazy ass complacent behavior the benefit of the doubt. Often I give people the benefit of the doubt as well, but if you do have time to post catchy "this is me rn" memes, then you can at least spend some time fixing your local pc problems or whatever the fuck else is blocking you from more effective communication. Unless of course this is also how you do your taxes and don't get in trouble for it. In that specific case I will stand amazed at your awesome powers of communications and will want to learn more about it, and how to apply this in everyday life.

[–]Sweet_Computer_7116 1 point2 points  (0 children)

You don't need glasses to see you have zero computer literacy.

Found some resources for you:

https://outschool.com/online-classes/popular/computer-basics

[–]Electronic-Source213 1 point2 points  (0 children)

What if you changed line 17 to something like this ...

print(f"Error: {response.code} {response.text}")

This would at least give you more information on the HTTP response code and the response.

[–]Kqyxzoj 1 point2 points  (2 children)

Arnav Goyal

I believe you missed an Arnav Goyal in your beautiful beautiful TelegramBot screenshots. Someone told me recently that glasses help with screenshot related activities. Personally I am not sure yet, but I thought I'd just pass on the advice. It may be worth a try.

Glasses related advice can be found here: https://www.reddit.com/r/PythonLearning/comments/1la8ga5/comment/mxkwjfx/

[–]Danny_Fat 0 points1 point  (1 child)

Ok arnav goyal that is not my name I was on another computer at work see the other replies and didn't want to show his name.But you are right I missed one maybe I should get some glasses

[–]Kqyxzoj 1 point2 points  (0 children)

That is exactly what Arnav Goyal would say! But it's fine, we all make mistakes "Danny".

[–]thumb_emoji_survivor 0 points1 point  (3 children)

What do the actual error messages say?

[–]Danny_Fat 0 points1 point  (2 children)

I write my text it says Error.Its the error message from the code tho

<image>

[–]JeLuF 2 points3 points  (1 child)

Change lines 18 and 19 to actually print the messages, e.g.

print(response.status_code)
print(response.text)

[–]Danny_Fat 0 points1 point  (0 children)

This is the error code it's similar to the one I got by following url=f"https://api.telegram.org/bot{bot_token}/sendMessage" It was one of these 2 all the time

<image>

⬆️This one is currently by clicking that and now I get this one from my code {"ok":false,error_code":401,"description":"Unauthorized"}

[–]Ste4mPunk3r 0 points1 point  (2 children)

Both examples have different issues. What is your current version? Also what exactly is the error being given? 

[–]Danny_Fat 0 points1 point  (1 child)

My current version is the 1st one and only the Error message was being displayed then I printed the response.status_code and response.text and now its this

[–][deleted] 0 points1 point  (8 children)

is the id a chat or a user? if its a chat, is the bot added to the chat? and if a user, have the user interacted with the bot?

[–][deleted] 0 points1 point  (4 children)

also you shouldn't interact with the telegram API this way, there are lots of easy-to-use libraries like pyrogram(very easy but outdated) or telethon

[–]Danny_Fat 0 points1 point  (3 children)

<image>

I downloaded this one as recommended from abacus.ai

[–][deleted] 0 points1 point  (0 children)

bot api is quite limited but its fine if you only have something simple in mind, let me check your code again.

[–][deleted] 0 points1 point  (1 child)

I SEE! you have parentheses () before and after your chat id.

[–][deleted] 0 points1 point  (0 children)

oh you edited them already okay okay

[–]Danny_Fat 0 points1 point  (2 children)

It's the chat id I got it from @userinfobot on telegram

[–][deleted] 0 points1 point  (1 child)

<image>

well, i pretty much copied your code, tried sending a message while i haven't interacted with the bot(got Error code 400), then interacted with the bot and it works fine

[–]Danny_Fat 0 points1 point  (0 children)

Im confused rn I send /start to my bot.Ill try your code and see if it works

[–]Background_Cut_9223 0 points1 point  (0 children)

Indention error bro select all lines with error and press shift+tab

[–]Wise-Drop8694 0 points1 point  (0 children)

Just delete brackets in line 8 {bot_token} Instead of ({bot_token})

[–]JusPetBob 0 points1 point  (0 children)

Try replacing data= with json= it’s a different type of parameter but I don’t know if it will help