-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57c5097
Showing
19 changed files
with
4,496 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"commonjs": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended"], | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"rules": { | ||
"no-case-declarations": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
.idea | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"singleQuote": true, | ||
"arrowParens": "always", | ||
"tabWidth": 4, | ||
"printWidth": 120, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"semi": false, | ||
"quoteProps": "as-needed" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 titsex | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# distube-vk-music-plugin | ||
<div> | ||
<a href="https://nodei.co/npm/distube-vk-music-plugin"> | ||
<img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/distube-vk-music-plugin/peer/distube?style=flat-square" /> | ||
</a> | ||
<a href="https://nodei.co/npm/distube-vk-music-plugin"> | ||
<img alt="npm" src="https://img.shields.io/npm/dt/distube-vk-music-plugin?logo=npm&style=flat-square"> | ||
</a> | ||
<a href="https://github.com/titsex/distube-vk-music-plugin"> | ||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/titsex/distube-vk-music-plugin?logo=github&logoColor=white&style=flat-square"> | ||
</a> | ||
</div> | ||
Custom Distube plugin for VK Music support. | ||
|
||
# Feature | ||
| type | example link | ☑️ | | ||
|--------------|-------------------------------------------------|----| | ||
| playlist | https://vk.com/music/playlist/-192000782_406 | ✅ | | ||
| album | https://vk.com/music/album/-2000892528_18892528 | ✅ | | ||
| artist | https://vk.com/artist/nepridymal_mty0oty4odm2mw | ✅ | | ||
| audio | https://vk.com/audio-2001624323_122624323 | ✅ | | ||
| user audios | https://vk.com/titsex | ✅ | | ||
| group audios | https://vk.com/ne_pridymal_group | ✅ | | ||
|
||
# Installation | ||
``` | ||
npm install distube-vk-music-plugin | ||
yarn add distube-vk-music-plugin | ||
pnpm add distube-vk-music-plugin | ||
``` | ||
|
||
# Using | ||
```ts | ||
import { VKMusicPlugin } from 'distube-vk-music-plugin' | ||
import { Client, GatewayIntentBits } from 'discord.js' | ||
import { DisTube } from 'distube' | ||
|
||
const client = new Client({ | ||
intents: [ | ||
GatewayIntentBits.Guilds, | ||
GatewayIntentBits.GuildMessages, | ||
GatewayIntentBits.MessageContent, | ||
GatewayIntentBits.GuildMembers, | ||
GatewayIntentBits.GuildVoiceStates, | ||
] | ||
}) | ||
|
||
const distube = new DisTube(client, { | ||
plugins: [new VKMusicPlugin({ token: 'vk token' })] | ||
}) | ||
|
||
client.login('bot token') | ||
``` | ||
|
||
# Example of plugin error handling | ||
```ts | ||
import { VK_PLUGIN_ERROR_CODE, VKErrors } from 'distube-vk-music-plugin' | ||
import { DisTubeError } from 'distube' | ||
|
||
client.on('error', (error) => { | ||
if (error instanceof DisTubeError) { | ||
if (error.errorCode === VK_PLUGIN_ERROR_CODE) { | ||
switch (error.message as VKErrors) { | ||
case VKErrors.PLAYLIST_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.PLAYLIST_SONGS_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.ARTIST_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.ARTIST_SONGS_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.AUDIO_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.USER_OR_GROUP_NOT_FOUND: | ||
// code here... | ||
break | ||
case VKErrors.URL_NOT_SUPPORT: | ||
// code here... | ||
break | ||
default: | ||
// Unexpected errors, create an issue here: https://github.com/titsex/distube-vk-music-plugin/issues | ||
break | ||
} | ||
} | ||
} | ||
}) | ||
``` | ||
|
||
# Documentation | ||
### VKMusicPlugin[VKMusicPluginOptions] | ||
* ```token``` is required, to get it, follow the [link](https://oauth.vk.com/authorize?client_id=2685278&scope=65536&response_type=token&revoke=1), click "allow" and copy everything between access_token= and &expires_in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "distube-vk-music-plugin", | ||
"description": "A DisTube custom plugin for supporting VK Music.", | ||
"author": "titsex", | ||
"version": "1.0.0", | ||
"main": "./dist/plugin.js", | ||
"types": "./dist/plugin.d.ts", | ||
"exports": "./dist/plugin.js", | ||
"directories": { | ||
"lib": "src" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "tsup", | ||
"build:check": "tsc", | ||
"prerelease": "npm-run-all build:check build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/titsex/distube-vk-music-plugin.git" | ||
}, | ||
"keywords": [ | ||
"distube", | ||
"plugin", | ||
"vk", | ||
"music", | ||
"vkmusic", | ||
"discord" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/titsex/distube-vk-music-plugin/issues" | ||
}, | ||
"homepage": "https://github.com/titsex/distube-vk-music-plugin#readme", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.16.0", | ||
"@typescript-eslint/parser": "^6.16.0", | ||
"@vitest/coverage-v8": "^1.1.1", | ||
"dotenv": "^16.3.1", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^3.1.1", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"axios": "^1.6.3" | ||
}, | ||
"peerDependencies": { | ||
"discord.js": "14", | ||
"distube": "^3.3.1||4" | ||
} | ||
} |
Oops, something went wrong.