English | 中文
This repository is created just for learning python(Commercial prohibition).
All the apis used in this repository are from public network. So, if you wanna to listen the paid songs,
please open a paid member on corresponding music platform by yourself (respect the music copyright please).
Finally, if there are any infringements, please contact me to delete this repository.
- Multi platform
- All async
- Container as a service
- Docker, whether you are deploying based on docker or binaries.
- Python >= 3.9, if you wanna to deploy it based on source code.
I highly recommend you to deploy based on docker because it is easy to configure.
- if you havn't install docker, please follow these instructions.
- check if your docker is ready.
docker version
- pull the Kyouka bot image and khl-voice image.
Kyouka bot image provides multi-architecture support for
linux/amd64
andlinux/arm64
.
khl-voice image only support forlinux/amd64
arch.
If you are using
Windows/x86_64
,macos/amd64
,macos/arm64
, don't worry about that, you can also run images targeted for a different architecture on Docker Desktop.
docker pull shuyangzhang/kyouka
docker pull shuyangzhang/khl-voice
- copy the
.env.template
file from this repository or clone this repository, then rename it to.env
.
git clone https://github.com/shuyangzhang/Kyouka.git
cd Kyouka
mv .env.template .env
- configure the
.env
file.
WARN: Do not insert any useless characters (including spaces, comments) at the end of the lines of configuration items, otherwise it will cause json parsing failure.
# your bot token
TOKEN=1/MECxOTk=/zCX2VjWr6p+AmD84jL9asQ==
# default voice channel
CHANNEL=2559449076697969
# the name of khl-voice sdk container, it should be different with your manager(bot) container name
CONTAINER_NAME=kyouka-runner
# the admin user id list
ADMIN_USERS=["693543263"]
# the file_logger switch
FILE_LOGGER=false
- create container for Kyouka bot.
docker run --name kyouka-manager --env-file .env -v /var/run/docker.sock:/var/run/docker.sock --restart always -d shuyangzhang/kyouka
- now the bot in running, send a
/ping
command in your channel, if Kyouka reply you, that means your deployment is completed, enjoy!
WARN: make sure that you have granted your bot read & send permissions.
if you are using
Win10
/Win11
, I highly recommend you to run these scripts in WSL2.
- same to step 1 of
deploy based on docker service
, install docker and check if it is ready.
docker version
make sure that you can run
docker
command withoutsudo
. seeing Manage Docker as a non-root user
- pull the khl-voice image
docker pull shuyangzhang/khl-voice
- make sure you have installed
Python
, and its version >= 3.9
python -V
- clone this repository, then rename
.env.template
file to.env
.
git clone https://github.com/shuyangzhang/Kyouka.git
cd Kyouka
mv .env.template .env
- configure the
.env
file.
WARN: Do not insert any useless characters (including spaces, comments) at the end of the lines of configuration items, otherwise it will cause json parsing failure.
# your bot token
TOKEN=1/MECxOTk=/zCX2VjWr6p+AmD84jL9asQ==
# default voice channel
CHANNEL=2559449076697969
# the name of khl-voice sdk container, it should be different with your manager(bot) container name
CONTAINER_NAME=kyouka-runner
# the admin user id list
ADMIN_USERS=["693543263"]
# the file_logger switch
FILE_LOGGER=false
- install python dependencies.
# install vritualenv and initialize a venv for your bot
pip install virtualenv -i https://pypi.tuna.tsinghua.edu.cn/simple
virtualenv venv
# activate venv
source venv/bin/activate
# install dependencies
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- run the Kyouka bot.
python startup.py
- now the bot in running, send a
/ping
command in your channel, if Kyouka reply you, that means your deployment is completed, enjoy!
WARN: make sure that you have granted your bot read & send permissions.
send a /help
command in you channel, Kyouka will teach you how to use.
/ping
: check whether Kyouka is alive./help
: get usage from Kyouka./debug
: (only for admin) the debug switch./comehere
: bind the voice channel you are in./channel {channel_id}
: bind the voice channel with id./play {music_name}
: add a music to play list./search {keyword}
: search music by keyword from netease cloud music./msearch {keyword}
: search music by keyword from migu music./qsearch {keyword}
: search music by keyword from qq muisc./osearch {keyword}
: search music by keyword from game osu!./select {search_list_id}
: select a music from search result, then add it to play list./bilibili {bilibili_video_url}
: add a video from Bilibili to play list./list
: check the play list./cut
: play the next music in play list./playlist {playlist_url}
: import a netease cloud music play list to Kyouka./radio {radio_url}
: import a netease cloud music radio list to Kyouka./album {album_url}
: import a netease cloud music album to Kyouka./remove {list_id}
: remove a music from play list./top {list_id}
: place a music at the top of play list.
-
using the issue tracker
Use the issue tracker to suggest feature requests, report bugs, and ask questions. This is also a great way to connect with the developers of the project as well as others who are interested in this solution. -
changing the code base
Generally speaking, you should fork this repository, make changes in your own fork, and then submit a pull request. All commit messages should satisfy Conventional Commits
This project is licensed under the terms of the MIT license.
If you need help, have any comments and suggestions, or want to develop Kyouka together, feel free to join our official community: https://kaihei.co/oHRMIL
This project is all based on khl.py