Welcome to pyryver!

A reverse engineered and very functional API for building things that mess with Ryver(tm).

Features

  • asyncio ready API.

  • Support for using the as-of-yet undocumented realtime WebSockets interface.

  • Easy to understand design for chatting in chats, messing with messages, managing users and handling notifications.

  • Only depends on aiohttp!

Example Usage

 1import pyryver
 2import asyncio
 3
 4async def main():
 5    # Connect to ryver
 6    async with pyryver.Ryver("my_organization", "my_username", "my_password") as ryver:
 7        # Load all chats
 8        await ryver.load_chats()
 9        
10        # get a user by username
11        my_friend = ryver.get_user(username="tylertian123")
12        me = ryver.get_user(username="my_username")
13        # send a message to a chat (in this case a DM)
14        await my_friend.send_message("hello there") 
15
16        # connect to the websockets interface
17        async with ryver.get_live_session(auto_reconnect=True) as session:
18            @session.on_chat
19            async def on_message(msg: pyryver.WSChatMessageData):
20                print(msg.text) # print out the message's text
21                # Reply to the message
22                # Make sure to check that the message isn't from the bot itself
23                if msg.from_jid != me.get_jid() and msg.text == "hello":
24                    # Send a message to the same chat
25                    # This could be either a user (for a private message) or a forum/team
26                    chat = ryver.get_chat(jid=msg.to_jid)
27                    await chat.send_message("hi")
28        
29            # run until session.terminate() is called
30            await session.run_forever()
31
32asyncio.get_event_loop().run_until_complete(main())

Table Of Contents