Skip to main content

SDK for kaiheila.cn in python

Project description

khl.py

SDK for kaiheila.cn in python

install

Python requirement: >= Python 3.6

pip install khl.py

quickly enroll

from khl import TextMsg, Bot, Cert

# init Cert and Bot
cert = Cert(client_id='xxxxxxxx', client_secret='xxxxxxxx', token='xxxxxxxx')
bot = Bot(cmd_prefix=['!', '!'], cert=cert)


@bot.command(name='hello')
async def roll(msg: TextMsg):
    await msg.reply('world!')


bot.run()
# now invite the bot to ur server,
# and type '!hello'(in any channel) to check ur san today!
# (remember to grant read & send permissions to the bot first)

notes for Mac OSX users:

if you encounter this error:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

please install certi manually, turning to this post for guide:

certificate verify failed: unable to get local issuer certificate

short-term roadmap

refactor

  • move api req urls into hardcoded

docs

  • examples & tutorials (active @TWT233)
  • docstring (v0.0.10)

perf:

  • async bot.run() (v0.0.11)
  • websocket refine (v0.0.11/.12)

feat:

T1:

T2:

  • bot send args (done by @fi6, waiting for merge)
    • needs more practice and design
  • command & arg parse system(long term design needed)
  • event class(interface)

commit message rules

only accept commits satisfying Conventional Commits convention

search plugins with keyword commitizen for your editor/IDE, then addict to write commit message

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

khl.py-0.0.10rc1-py3-none-any.whl (26.0 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