Intended for the Members Only chat, should work anywhere the bot is an admin. Only works for directors.
Banning / removing members from the chat can also be added, haven't yet
After trying several methods to get the Telegram API to give me the list of group members, I have up and resorted to the following:
Fetch all members that expired/stopping paying in the last N months (defaults to 6)
filter for ones that have a telegram id associated
use getChatMember (this chat, member telegram id) to check if they're in the chat
Add to list if true
Since it needs to obey API rate limiting (max 30 calls per sec) it will be quite slow if asked to do everybody, thus the time restriction.
SQL produced looks like:
SELECT person.id, person.telegram_chatid, person.name FROM (SELECT me.person_id, MAX( expires_on_date )
AS max_expires FROM dues me GROUP BY person_id) me JOIN people person ON person.id = me.person_id WHERE
( ( ( me.max_expires BETWEEN ? AND ? ) AND person.telegram_chatid IS NOT NULL ) ): '2023-09-11 17:37:18
', '2024-03-11 17:37:18'
Fixes #70
Intended for the Members Only chat, should work anywhere the bot is an admin. Only works for directors.
Banning / removing members from the chat can also be added, haven't yet
After trying several methods to get the Telegram API to give me the list of group members, I have up and resorted to the following:
Since it needs to obey API rate limiting (max 30 calls per sec) it will be quite slow if asked to do everybody, thus the time restriction.
SQL produced looks like: