klappvisor / haskell-telegram-api

Telegram Bot API for Haskell
BSD 3-Clause "New" or "Revised" License
201 stars 67 forks source link

Add group administration tools. #18

Closed klappvisor closed 8 years ago

klappvisor commented 8 years ago

New methods kickChatMember and unbanChatMember.

Arguggi commented 8 years ago

I added kickChatMember and unbanChatMember in my fork on branch Fix#18 based on my master (so the one with servant v0.6) . kickChatMember correctly parses the response, I can't test unbanChatMember since I don't have a SuperGroup handy at the moment.

I'm not sure if tests can be added since I can't seem to find any addUserToGroup api or something similar.

I'm also not sure of how to get the correct number to use with toJsonDrop when parsing / creating the response, any pointers? (I manually tested kickChatMember).

klappvisor commented 8 years ago

@Arguggi Thanks, I have created bot-2.0 branch for us to create merge requests. It would be great if you will do pull request to that branch. (I am going to merge #26 manually to that branch instead of master tonight).

Sometimes it's quite hard to test some features, so I'm OK with it.

toJsonDrop basically is needed only to serialize/deserialize field name correctly. There is very desirable GHC feature OverloadedRecordFields which will make code much cleaner. Right now I have to add prefix like iqm_ and then property name. So that number is number of symbols to ignore during JSON serialization/deserialization.

for property name: imq_text it will be 4 and real property name is just text, for iq_res_query_id it is 7 and real field name is query_id.

Arguggi commented 8 years ago

Ah I understand now, thanks. I've fixed the unban Json instances accordingly. I'll send the PR later.