Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for web requests #126

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/content/features/auto-responses/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,26 @@ assert(sum(nums) == 5050)
assert(sum(values) == 10.0)
```

#### Get
The `get` function acts as an HTTP get request. It requires a url as a parameter and can optionally take a dict of headers.

```py
resp = get("https://my-api.host.com/endpoint", headers={"my-header": "my-data"})
```

#### Post
The `post` function acts as an HTTP post request. It requires a url as a parameter and can optionally take a dict of headers, a dict of json data, or raw data as keyword parameters. The keywords are "headers", "json", and "data" respectively.

<Alert type="info">

Only one of the json or headers keyword parameters can be used at a time. If they are both passed to the function, json will take priority and data will be ignored.

</Alert>

```py
resp = post("https://api.archit.us/guild-count", headers={"custom-header": "value"}, json={"data": 1234})
```

### Global Variables
Architus adds several global variables to the script environment to allow users to access information about the message, author, and channel that triggered the auto-response:

Expand Down