rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.68k stars 1.18k forks source link

No setters in ChatPermissions #646

Closed Djaler closed 4 years ago

Djaler commented 5 years ago

There are no way to create ChatPermissions with non-false values

Chase22 commented 5 years ago

ChatPermissions is an Object only returned by the telegram api. You don't want to create it.

If you want to set chat permissions for a person, use SetChatPermissions

Djaler commented 5 years ago

I don't think so https://github.com/rubenlagus/TelegramBots/blob/f85409f8529b527c41f202dffa4bba0cafb25f0e/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/RestrictChatMember.java#L198

Djaler commented 5 years ago

SetChatPermissions is for setting default permissions for all members. And, anyway, to create SetChatPermissions you need a ChatPermissions: https://github.com/rubenlagus/TelegramBots/blob/f85409f8529b527c41f202dffa4bba0cafb25f0e/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPermissions.java#L38

Chase22 commented 5 years ago

Just looked at the code more, The individual setters got deprecated in the newest version @rubenlagus can you take a look at this?

san3ani commented 5 years ago

Hello Any updates about this issue. I tried to pass a new ChatPermissions and I was able to restrict member using the old way. However undoing the restriction did not work.

Djaler commented 4 years ago

Looks like it was fixed by 44c814256d61615dca5626ac186d1eb6166ef2ae