Official Order Python API Wrapper
Hi!
This repository contains the source code of the Order API wrapper for the Python programming language meant for writing bots. It could be used for typical user accounts as well, and this is not prohibited by the Terms of Service in any way, but not all functions of the API are fully implemented to fulfill every action a human user might take in the app.
Installation
pip3 install order.py
How do I get a bot token?
Head into the app. Open user settings by clicking on you avatar in the bottom-right corner. Navigate to the "Developers" tab
Choose a cool name and hit the "create" button. Below that you will see the list of bot IDs you have created previously.
Once you did that, you should see a big popup. Copy the bot ID and token and save them in a separate file. You will only see this token once!
How do I use my bot?
Bots can only be used in groups. In order to add a bot, you should know its ID.
Head into the app. Choose or create a group you would like to add the bot into. Open its settings by clicking on its title in the top-left corner. Navigate to the "Invites" tab. Paste your bot ID into the "Bot ID" field. Click the "Invite bot" button. You're all set!
Simple bot example
Sends "Hi!" when it receives "hello"
import order
from order import entities
from order.entities import Message
import time
async def on_message(message, text):
if text.lower() == 'hello':
await client.put_entities([
Message.create(sections=[
Message.TextSection.create('Hi!')
], channel=message.channel)
])
async def on_entities(packet):
for e in packet.entities:
if isinstance(e, Message):
# find the first text section
for s in e.sections:
if isinstance(s, Message.TextSection):
await on_message(e, s.text)
break
async def on_connected():
await client.login_with_bot_token('BOT_TOKEN')
async def on_logged_in(user):
print('Logged in as ' + user.name + '#' + str(user.tag))
client = order.Order(debug_protocol=False)
client.handler('connected', on_connected)
client.handler('logged_in', on_logged_in)
client.handler('entities', on_entities)
client.run()
Metadata
Release files for order.py 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| order.py-0.0.4.tar.gz | 9.9 kB | Without provenance | Details for order.py-0.0.4.tar.gz |
Release files / order.py-0.0.4.tar.gz
| Download URL | order.py-0.0.4.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73fcb74c4a0155395be3f2a26ecffa30f1acad8c1b6dfc1896436c203760c2b8
|
|
BLAKE2b-256 checksum How to use checksums |
efd800513238fb0fb303bfb63527fe5b5e013910ad1e43aaa3b8e95c6eedb47a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Security for order.py 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.