Git Product home page Git Product logo

kook-arisa's Introduction

kook-arisa

Yet another KOOK music bot, with a web dashboard.

Self Host

  1. Clone the repo and install dependencies
git clone https://github.com/saltcute/kook-arisa
cd kook-arisa
npm i
  1. Create a config file from template
cp src/config/template-config.json5 src/config/config.json5
  1. Edit the config file
  • Here are some config entries that you have to fill out.
{
    // KOOK connection settings. See https://kasumi.js.org/introduction/getting-started.html.
    "kasumi::config.token": "1/CR4Zyt=/thUr5d4YVme50pLSq5Ee9MA==",
    "kasumi::config.connection": "kookts",
    "kasumi::config.webhookVerifyToken": "",
    "kasumi::config.webhookEncryptKey": "",
    "kasumi::config.webhookPort": 11451,

    // MongoDB connection URI. kook-arisa requires a running mongodb to work at the moment.
    "kasumi::config.mongoConnectionString": "mongodb://localhost:27017",

    // Users whose id is in this array will have Admin group.
    // Use /arisaadmin to see admin commands.
    globalAdmins: ["1854484583"],

    // This is the actual bot that will join a voice channel.
    // It could be the same as kasumi::config.token, but just to be safe a different one is recommended.
    // You need at least one token.
    streamers: [
        "1/CR4Zyt=/thUr5d4YVme50pLSq5Ee9MA==",
        "1/SU1SeI=/H4N3MuaN4taN0rENdEzV0us==",
    ],
}
  • These setting are optional.
{
    // Client ID and Client Secret is required for webui to work.
    kookClientID: "",
    // You need to have access to KOOK's oauth2 to get this.
    kookClientSecret: "",

    // Optionally use other ports.
    internalWebuiPort: 80,
    // This URL will be in cards and logs where it needs to link to the webui.
    webuiUrl: "http://localhost",

    // Set this to true to play VIP-exclusive tracks on Netease Cloud Music.
    neteaseVIP: false,
    // Your credentials are only sent to Netease's servers.
    neteaseEmail: "[email protected]",
    neteasePassword: "up!side@down#side$up%and^down",

    // This is a random string that you will need if you want to update the cookie of QQ Music.
    QQCookieCode: "11.86 mata aeru",

    // This is required if you want the bot to play in a new server automatically. See below for more.
    streamerMiddlemanID: "",
    streamerMiddlemanToken: "",
}

Update QQ Music Cookie

Most (90%) of the tracks on QQ Music needs a valid cookie to play. You can use saltcute/QQMusicCookieRefresh to refresh the cookie automatically. You need to login the QQ account to a normal QQ client on the server to use this.

Or you can also send a POST request to ${webuiUrl}/qqmusic/updateCookie with the body:

{
    code: "The string you put in config",
    cookie: "The cookie string",
}

Streamer Middleman?

Due to limitation on KOOK's side, one single bot can only stream to one voice channel. kook-arisa get around with that limitation by using separate bots for each play session. This was originally done by using /v3/guild/join endpoint. However, this was soon patched by KOOK (reasonably), so that bots can no longer join an arbitary server on its own.

As a workaround, streamer middleman is implemented by using a normal user account to invite the bot to the server. The middleman will first join the server with /v2/guilds/join and then invite the bot using oauth2 (Yes you hear it right lol and see details here).

With that, the config entries become obvious:

{
    // KOOK user ID of the middleman.
    streamerMiddlemanID: "",
    // KOOK user token of the middleman.
    // You can get this at `localStorage.authorization` in DevTools
    streamerMiddlemanToken: "",
}

The middleman should not be the same user as the one you want to listen to the stream. So you will need a alt account.

However, if you are willing to manually invite all the streamer to your server when self hosting, it should be fine to leave it empty (not fully tested).

kook-arisa's People

Contributors

saltcute avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kevinmatthe

kook-arisa's Issues

Selfhost Option?

Will this project provide a method to self host the bot via docker or something else?

关于频道人员退出检测问题

当语言频道有人退出,且频道内任然有人在线时,机器人退出并返回“播放结束,总时长 xx:xx,原因:语音频道内无用户”
When someone exits the language channel and there is still someone online in the channel, the robot exits and returns "Playback ended, total duration xx: xx, reason: no user in the voice channel"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.