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¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import pyryver
import asyncio
async def main():
# Connect to ryver
async with pyryver.Ryver("myorg", "username", "password") as ryver:
await ryver.load_users()
# get a user by username
my_friend = ryver.get_user(username="tylertian123")
# send a message to a chat (in this case a DM)
await my_friend.send_message("hello there")
# connect to the websockets interface
async with ryver.get_live_session() as session:
@session.on_chat
def on_message(msg):
print(msg["text"]) # print out the message's text
# run until session.close()
await session.run_forever()
asyncio.get_event_loop().run_until_complete(main())
|