Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cry-vs.py-0.0.0.7.tar.gz (17.9 kB view hashes)

Uploaded Source

Built Distribution

cry_vs.py-0.0.0.7-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page