Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Add methods and classes #49

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

RubenIgnacio
Copy link

Hello, add some methods and classes that I found useful or missing, such as the MessageEntity class or methods like is_bot? in User and methods to obtain mentions, commands, etc. in message.

@eljojo
Copy link
Owner

eljojo commented Oct 31, 2018

Hi, this is super good stuff but I'm not entirely sure about what's going on here.

Could you make a list of changes that you've done (high level is ok), along with why they make sense?

@RubenIgnacio
Copy link
Author

@eljojo Yes of course, the changes that I made were basically:

  • Added missing attributes is_bot and language_code to User and the method full_name.

  • Create the class MessageEntity for the attribute entities from Message.

  • With the class MessageEntity its also added to Message methods like get_mentions, get_bot_commands, get_text_links, etc. that return an array of strings with the text of the message from the specified position in the offset of each entity, there is also his singular version for example get_mention that returns to the first mention it founds.

  • Added missing attributes to Message like entities, edit_date, media_group_id, new_chat_members, forward_from etc, only needs to add the attributes for which it is necessary to create their respective classes.

  • Added the attributes edited_message, channel_post and edited_channel_post to Update along with the get_message method that returns the update either message, edited_message, channel_post or edited_channel_post.

  • Change the class Client to Connection and in this just add the method request and other methods like get and post that return an instance of Result and use methods like get to make the requests to obtain data such as updates or the use post to send data such as sending a message with the bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants