1
0
Fork 0

Re-implement `subscribe` command

This allows for re-subscribing to contact presences without returning
the large response for the `contacts` command.
This commit is contained in:
Alex Palaistras 2024-02-10 17:53:57 +00:00
parent 923db9cba2
commit ba1cbbafe3
1 changed files with 21 additions and 0 deletions

View File

@ -120,3 +120,24 @@ class ChangePresence(Command):
else:
raise ValueError("Not a valid presence kind.", p)
return f"Presence succesfully set to {p}"
class SubscribeToPresences(Command):
NAME = "Subscribe to contacts' presences"
HELP = (
"This command is here for tests about "
"https://todo.sr.ht/~nicoco/slidge-whatsapp/7 ."
)
NODE = "wa_subscribe"
CHAT_COMMAND = "subscribe"
ACCESS = CommandAccess.USER_LOGGED
async def run(
self,
session: Optional["Session"], # type:ignore
ifrom: JID,
*args,
) -> str:
assert session is not None
session.whatsapp.GetContacts(False)
return "Looks like no exception was raised. Success, I guess?"