A Crypto-Versus wrapper
Project description
cry-vs
An official API wrapper for Crypto_Versus
Installation
Installation is simple. just run $ python -m pip install cry_vs.py
in your terminal.
Usage
This package is used in a way similar to discord.py. if you know how to use discord.py, the following steps should be a cakewalk.
Initialization & logger setup
First set up the logging module. this is not necessary because cry_vs will try to set up the logging module for you, but is highly recommended.
import logging, sys
logging.basicConfig(encoding="utf-8", stream=sys.stdout, level=logging.INFO)
Next, import cry_vs's client class.
from cry_vs.client import Client
Once you have done that, you can create a client.
cry = Client()
while key is the only required argument, you can also pass in the other arguments.
Other arguments that Client accepts
-
server: string = "cry-vs.herokuapp.com"
the url of the server you want to connect to. -
allow_unsecure: bool = False
whether to allow unsecure connections.
events
Now that you have a client, you can start listening to events. to do so, just make a function with the @cry.listen
decorator.
for example, if you want to listen to the on_ready
event, you would do the following:
@cry.listen
async def on_ready():
print("on_ready has been called")
you can add as many events as you want, and they depend on the name. (function must be asynchronous)
All events
-
any_event()
fired when any event is called -
on_ready()
fired when the event emitter is initialized (right after the client has logged in) -
before_expire()
fired up to 2 seconds before the token expires
finalize
finally, you can call cry.login()
to start the client.
this will start the event loop, and will not return until the client is closed. any logic that needs to be done after the client has been started should be done in the on_ready
event.
you can log in with a key:
cry.login("KEY")
or with your username and password:
cry.login("USERNAME", "PASSWORD")
found an issue? (Please make a PR!)[https://github.com/AW1534/cry-vs]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cry_vs.py-0.0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b2203d29014d6c25a13485481a8fa96eadfd4a0c0ad1815a287c0f88f0c6ddd |
|
MD5 | ecf8402de0969f89c9809cc737203b77 |
|
BLAKE2b-256 | c9df0db522cfe90e2ed537854789917ea9d76eb4a729f585337f0265fbeff109 |