I'd appreciate if you could give me an example as to what organized/well written code would look like.
I'd like to think this is understandable
def update_info(self):
"""
Updates the bot's info.
It makes a request to the Telegram API method getMe for your bot. So, it
can take a second, and you probably shouldn't use this in any situation
where getting a result is time-sensitive (e.g. for a web application).
This method is used in :py:meth:`__init__()` if initial_check is True.
"""
r = requests.get(self.url + 'getMe')
if r.status_code == 200:
response = json.loads(r.text)
if response['ok']:
bot_info = response['result']
self.user_id = bot_info['id']
self.first_name = bot_info['first_name']
if 'last_name' in bot_info:
self.last_name = bot_info['last_name']
if 'username' in bot_info:
self.username = bot_info['username']
else:
raise TelegramError('The result was not "ok"')
else:
raise TelegramError('Did not get a 200 response', r.status_code)it's a method that is part of a class, so "self" refers to the instance of the class that was used to call it
if you don't know anything about python's syntax, you'll probably still have a hard time understanding all of it
and if you don't know anything about the Telegram API, you probably won't understand exactly what it does
but most of it is relatively clear. it sends a request a web site, and sticks the information from the response into the object
Isnt JS a part of ECMAscript?
javascript is an implementation of the ECMAScript specification