-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AW1534/dev
Dev
- Loading branch information
Showing
13 changed files
with
146 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
/.idea/ | ||
*.log | ||
*.env | ||
|
||
# all files created by the build process | ||
/docs/_build/ | ||
/docs/_build/ | ||
/__pycache__/ | ||
*.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ build: | |
sphinx: | ||
builder: html | ||
configuration: docs/conf.py | ||
fail_on_warning: false | ||
|
||
python: | ||
install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "0.0.0.12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// this script is intended for use with the sphinx books theme for sphinx | ||
|
||
|
||
// override ctrl + f command | ||
document.addEventListener('keydown', function(e) { | ||
if (e.keyCode === 70 && e.ctrlKey) { | ||
e.preventDefault(); | ||
document.getElementById('search-input').focus(); | ||
e.preventDefault(); // cancel default behavior | ||
let navigation = document.getElementById("__navigation") // get the navigation element | ||
|
||
if (navigation.checked) { // if the navigation is not visible, show it, wait for a small delay and focus the search input | ||
document.getElementById("__navigation").checked = false; | ||
setTimeout(() => document.getElementById('search-input').focus(), 10); | ||
} else { // if the navigation is visible, just focus the search input | ||
document.getElementById('search-input').focus() | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,4 @@ | |
|
||
|
||
def setup(app): | ||
app.add_js_file("_static/js/script.js") | ||
app.add_js_file("js/script.js") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# API reference | ||
An official API wrapper for [Crypto_Versus](https://github.com/ProtagonistsWasTaken/crypto_versus) | ||
|
||
## Installation | ||
Installation is simple. just run `$ python -m pip install cry_vs.py` in your terminal. | ||
|
||
## Usage | ||
```{note} | ||
This package is used in a way similar to [discord.py](https://pypi.org/project/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. | ||
```python | ||
import logging, sys | ||
logging.basicConfig(encoding="utf-8", stream=sys.stdout, level=logging.INFO) | ||
``` | ||
|
||
Next, import cry_vs's client class. | ||
|
||
```python | ||
from cry_vs.client import Client | ||
``` | ||
|
||
Once you have done that, you can create a client. | ||
|
||
```python | ||
cry = Client() | ||
``` | ||
|
||
while there are no required arguments, you can also pass in the other arguments. | ||
|
||
| **Name** | **Type** | **Default value** | **Description** | | ||
|--------------------|----------|------------------------|-----------------------------------------------------------------------------| | ||
| **host** | string | "cry-vs.herokuapp.com" | The url of the server you want to connect to. | | ||
| **port** | int | 80 | The port that the socket should listen to. | | ||
| **allow_unsecure** | bool | False | Whether to allow unsecure connections. | | ||
| **keep_alive** | bool | True | Whether to keep the client validated by automatically refreshing the token. | | ||
|
||
|
||
--- | ||
### 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: | ||
```python | ||
@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) | ||
|
||
| **Name** | **Description** | | ||
|----------------------|------------------------------------------------------------------------------------| | ||
| **any_event** | Fired when any event is called | | | ||
| **on_ready** | Fired when the event emitter is initialized (right after the client has logged in) | | ||
| **on_token_refresh** | Fired after the token has been refreshed | | ||
|
||
--- | ||
### finalize | ||
finally, you can call `cry.login()` to start the client. | ||
|
||
````{tabbed} API Key | ||
```python | ||
cry.login("key") | ||
``` | ||
```` | ||
|
||
````{tabbed} Username and Password | ||
```python | ||
cry.login("username", "password") | ||
``` | ||
```` | ||
```{warning} | ||
this will start the event loop, and will not return until the client is closed. any logic that needs to be done after this function should be done in the `on_ready` event. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# store the directory of the script in a variable | ||
$dir = Get-Location | ||
|
||
# delete any existing distrobution files | ||
Remove-Item "$dir/dist" | ||
|
||
# install the latest version of dependencies | ||
py -m pip install --upgrade twine | ||
py -m pip install --upgrade build | ||
|
||
# build the distribution | ||
py -m build | ||
|
||
# upload the distribution to PyPI | ||
py -m twine upload --repository pypi dist/* | ||
PAUSE |