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

T1:

  • btn handler(ongoing)

T2:

  • rename files according to PEP8
  • wrap functions for convenient

perf:

  • refactor Msg, support multimedia msg (active @TWT233)
    • introduce MsgCtx with this

feat:

T1:

  • on_textMsg()
  • command & arg parse system(long term design needed)
  • event listener for bot
    • find another approach to handle msg
    • utilize event listener
  • add get for net client
  • command group
  • upload assets
  • event class(interface)

T2:

  • log system
  • MsgCtx design
  • command alias
  • bot send args (done by @fi6, waiting for merge)
  • no prefix commands
    • fix cmd_prefix=[]
  • more kinds of msg
  • action result

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 Distribution

khl.py-0.0.9.tar.gz (14.5 kB view hashes)

Uploaded Source

Built Distribution

khl.py-0.0.9-py3-none-any.whl (21.5 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