mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
fix url shorturl and music (please)
This commit is contained in:
parent
8963681b30
commit
8d2557fac8
8 changed files with 47 additions and 42 deletions
|
@ -45,7 +45,12 @@ class JaBaClient extends Client {
|
||||||
async init() {
|
async init() {
|
||||||
this.player = new DiscordPlayer(this);
|
this.player = new DiscordPlayer(this);
|
||||||
|
|
||||||
await this.player.extractors.register(YoutubeiExtractor);
|
await this.player.extractors.register(YoutubeiExtractor, {
|
||||||
|
authentication: this.config.youtubeCookie,
|
||||||
|
streamOptions: {
|
||||||
|
useClient: "ANDROID",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
await this.player.extractors.register(SpotifyExtractor, {
|
await this.player.extractors.register(SpotifyExtractor, {
|
||||||
clientId: this.config.spotify.clientId,
|
clientId: this.config.spotify.clientId,
|
||||||
|
|
|
@ -55,17 +55,17 @@ class LMGTFY extends BaseCommand {
|
||||||
url = `https://letmegooglethat.com/?q=${encodeURIComponent(query)}`;
|
url = `https://letmegooglethat.com/?q=${encodeURIComponent(query)}`;
|
||||||
|
|
||||||
if (short) {
|
if (short) {
|
||||||
const res = await fetch("https://plsgo.ru/rest/v3/short-urls", {
|
const res = await fetch("https://i.jonnybro.ru/api/shorten", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/json",
|
||||||
"X-Api-Key": client.config.apiKeys.shlink,
|
Authorization: client.config.apiKeys.zipline,
|
||||||
},
|
},
|
||||||
body: new URLSearchParams({ longUrl: url }),
|
body: JSON.stringify({ url: url }),
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `<${res.shortUrl}>`,
|
content: `<${res.url}>`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
|
|
|
@ -41,17 +41,19 @@ class Shorturl extends BaseCommand {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const url = interaction.options.getString("url");
|
const url = interaction.options.getString("url");
|
||||||
const res = await fetch("https://plsgo.ru/rest/v3/short-urls", {
|
const res = await fetch("https://i.jonnybro.ru/api/shorten", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/json",
|
||||||
"X-Api-Key": client.config.apiKeys.shlink,
|
Authorization: client.config.apiKeys.zipline,
|
||||||
},
|
},
|
||||||
body: new URLSearchParams({ longUrl: url }),
|
body: JSON.stringify({ url: url }),
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
|
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `<${res.shortUrl}>`,
|
content: `<${res.url}>`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,6 @@ class PlayContext extends BaseCommand {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!searchResult.hasTracks()) {
|
if (!searchResult.hasTracks()) {
|
||||||
console.log(searchResult);
|
|
||||||
|
|
||||||
return interaction.error("music/play:NO_RESULT", { query }, { edit: true });
|
return interaction.error("music/play:NO_RESULT", { query }, { edit: true });
|
||||||
} else {
|
} else {
|
||||||
await client.player.play(voice, searchResult, {
|
await client.player.play(voice, searchResult, {
|
||||||
|
|
|
@ -105,8 +105,6 @@ class Play extends BaseCommand {
|
||||||
}))
|
}))
|
||||||
.forEach(t => tracks.push({ name: t.name, value: t.value }));
|
.forEach(t => tracks.push({ name: t.name, value: t.value }));
|
||||||
|
|
||||||
console.log(tracks);
|
|
||||||
|
|
||||||
return interaction.respond(tracks);
|
return interaction.respond(tracks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,14 @@ module.exports = {
|
||||||
clientId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
clientId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
clientSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
clientSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
},
|
},
|
||||||
|
/* YouTube Cookie */
|
||||||
|
youtubeCookie: {
|
||||||
|
access_token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
refresh_token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
scope: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
token_type: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
expiry_date: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
},
|
||||||
/* Support server */
|
/* Support server */
|
||||||
support: {
|
support: {
|
||||||
id: "123456789098765432", // The ID of the support server
|
id: "123456789098765432", // The ID of the support server
|
||||||
|
@ -41,6 +49,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
/* Add your own API keys here */
|
/* Add your own API keys here */
|
||||||
apiKeys: {
|
apiKeys: {
|
||||||
shlink: "12345678-1234-1234-1234-123456789098", /* Shlink.io REST API key */
|
shlink: "12345678-1234-1234-1234-123456789098" /* Shlink.io REST API key */,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
"cron": "^2.4.4",
|
"cron": "^2.4.4",
|
||||||
"discord-api-types": "^0.37.92",
|
"discord-api-types": "^0.37.92",
|
||||||
"discord-giveaways": "^6.0.1",
|
"discord-giveaways": "^6.0.1",
|
||||||
"discord-player": "^6.7.0",
|
"discord-player": "^6.7.1",
|
||||||
"discord-player-youtubei": "^1.2.0",
|
"discord-player-youtubei": "^1.2.4",
|
||||||
"discord.js": "^14.15.3",
|
"discord.js": "^14.15.3",
|
||||||
"gamedig": "^4.1.0",
|
"gamedig": "^4.1.0",
|
||||||
"i18next": "^21.10.0",
|
"i18next": "^21.10.0",
|
||||||
|
|
|
@ -36,11 +36,11 @@ importers:
|
||||||
specifier: ^6.0.1
|
specifier: ^6.0.1
|
||||||
version: 6.0.1(discord.js@14.15.3)
|
version: 6.0.1(discord.js@14.15.3)
|
||||||
discord-player:
|
discord-player:
|
||||||
specifier: ^6.7.0
|
specifier: ^6.7.1
|
||||||
version: 6.7.0(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0)
|
version: 6.7.1(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0)
|
||||||
discord-player-youtubei:
|
discord-player-youtubei:
|
||||||
specifier: ^1.2.0
|
specifier: ^1.2.4
|
||||||
version: 1.2.0
|
version: 1.2.4
|
||||||
discord.js:
|
discord.js:
|
||||||
specifier: ^14.15.3
|
specifier: ^14.15.3
|
||||||
version: 14.15.3
|
version: 14.15.3
|
||||||
|
@ -474,12 +474,12 @@ packages:
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
discord.js: '>=14.0.0'
|
discord.js: '>=14.0.0'
|
||||||
|
|
||||||
discord-player-youtubei@1.2.0:
|
discord-player-youtubei@1.2.4:
|
||||||
resolution: {integrity: sha512-zI05CH8qVTNi1NcaUD2XKYwfw4Ye+6Ws9/sGZqoQxTI2LN8rVd0fBs/cX4GbRFevTWVqzZy4LvriQRe8OYJxFg==}
|
resolution: {integrity: sha512-kx6cXUz5tMUI+2E6ntRUCckCYYgFNWF872l6N3s4W29Jgmm+kkbefytogfsTM06ePncd1MQp6hBHoufr6b1TVQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
discord-player@6.7.0:
|
discord-player@6.7.1:
|
||||||
resolution: {integrity: sha512-ioSDZo3IreTi9B5ZRKca0Vh2FPbHjM25D4RoXTwhf6ULaGJEMMpi+GAyDPtzFGHbvIO0Fs/pnNcKtehICsODzg==}
|
resolution: {integrity: sha512-ScQmChpZebpVzs+RMsSkCXSORUIXUR3aHsEssGZSLKrbWnregt3jVc39emftTt6EfarZ2TvTK262mXeAYPzpcQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@discord-player/extractor': ^4.5.0
|
'@discord-player/extractor': ^4.5.0
|
||||||
|
|
||||||
|
@ -706,9 +706,6 @@ packages:
|
||||||
ip@2.0.0:
|
ip@2.0.0:
|
||||||
resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==}
|
resolution: {integrity: sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==}
|
||||||
|
|
||||||
ip@2.0.1:
|
|
||||||
resolution: {integrity: sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==}
|
|
||||||
|
|
||||||
is-buffer@1.1.6:
|
is-buffer@1.1.6:
|
||||||
resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==}
|
resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==}
|
||||||
|
|
||||||
|
@ -740,8 +737,8 @@ packages:
|
||||||
isomorphic-unfetch@4.0.2:
|
isomorphic-unfetch@4.0.2:
|
||||||
resolution: {integrity: sha512-1Yd+CF/7al18/N2BDbsLBcp6RO3tucSW+jcLq24dqdX5MNbCNTw1z4BsGsp4zNmjr/Izm2cs/cEqZPp4kvWSCA==}
|
resolution: {integrity: sha512-1Yd+CF/7al18/N2BDbsLBcp6RO3tucSW+jcLq24dqdX5MNbCNTw1z4BsGsp4zNmjr/Izm2cs/cEqZPp4kvWSCA==}
|
||||||
|
|
||||||
jintr@2.0.0:
|
jintr@2.1.1:
|
||||||
resolution: {integrity: sha512-RiVlevxttZ4eHEYB2dXKXDXluzHfRuw0DJQGsYuKCc5IvZj5/GbOakeqVX+Bar/G9kTty9xDJREcxukurkmYLA==}
|
resolution: {integrity: sha512-89cwX4ouogeDGOBsEVsVYsnWWvWjchmwXBB4kiBhmjOKw19FiOKhNhMhpxhTlK2ctl7DS+d/ethfmuBpzoNNgA==}
|
||||||
|
|
||||||
js-yaml@4.1.0:
|
js-yaml@4.1.0:
|
||||||
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
|
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
|
||||||
|
@ -1285,8 +1282,8 @@ packages:
|
||||||
youtube-sr@4.3.11:
|
youtube-sr@4.3.11:
|
||||||
resolution: {integrity: sha512-3oHiS2x7PpMiDRW7Cq8nz1bkAIBOJHoOwkPl/oncM/+A9/3xxMDgMLGW2dsBEP1DHFyRXYTVABgfbdwHF8sXXQ==}
|
resolution: {integrity: sha512-3oHiS2x7PpMiDRW7Cq8nz1bkAIBOJHoOwkPl/oncM/+A9/3xxMDgMLGW2dsBEP1DHFyRXYTVABgfbdwHF8sXXQ==}
|
||||||
|
|
||||||
youtubei.js@10.2.0:
|
youtubei.js@10.3.0:
|
||||||
resolution: {integrity: sha512-JLKW9AHQ1qrTwBbre1aDkH8UJFmNcc4+kOSaVou5jSY7AzfFPFJK0yvX6afnLst0UVC9wfXHrLiNx93sutVErA==}
|
resolution: {integrity: sha512-tLmeJCECK2xF2hZZtF2nEqirdKVNLFSDpa0LhTaXY3tngtL7doQXyy7M2CLueramDTlmCnFaW+rctHirTPFaRQ==}
|
||||||
|
|
||||||
ytdl-core@4.11.5:
|
ytdl-core@4.11.5:
|
||||||
resolution: {integrity: sha512-27LwsW4n4nyNviRCO1hmr8Wr5J1wLLMawHCQvH8Fk0hiRqrxuIu028WzbJetiYH28K8XDbeinYW4/wcHQD1EXA==}
|
resolution: {integrity: sha512-27LwsW4n4nyNviRCO1hmr8Wr5J1wLLMawHCQvH8Fk0hiRqrxuIu028WzbJetiYH28K8XDbeinYW4/wcHQD1EXA==}
|
||||||
|
@ -1707,12 +1704,12 @@ snapshots:
|
||||||
discord.js: 14.15.3
|
discord.js: 14.15.3
|
||||||
serialize-javascript: 6.0.1
|
serialize-javascript: 6.0.1
|
||||||
|
|
||||||
discord-player-youtubei@1.2.0:
|
discord-player-youtubei@1.2.4:
|
||||||
dependencies:
|
dependencies:
|
||||||
undici: 6.19.2
|
undici: 6.19.2
|
||||||
youtubei.js: 10.2.0
|
youtubei.js: 10.3.0
|
||||||
|
|
||||||
discord-player@6.7.0(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0):
|
discord-player@6.7.1(@discord-player/extractor@4.5.0)(@discordjs/opus@0.9.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@discord-player/equalizer': 0.2.3
|
'@discord-player/equalizer': 0.2.3
|
||||||
'@discord-player/extractor': 4.5.0
|
'@discord-player/extractor': 4.5.0
|
||||||
|
@ -1720,7 +1717,6 @@ snapshots:
|
||||||
'@discord-player/utils': 0.2.2
|
'@discord-player/utils': 0.2.2
|
||||||
'@web-scrobbler/metadata-filter': 3.1.0
|
'@web-scrobbler/metadata-filter': 3.1.0
|
||||||
discord-voip: 0.1.3(@discordjs/opus@0.9.0)
|
discord-voip: 0.1.3(@discordjs/opus@0.9.0)
|
||||||
ip: 2.0.1
|
|
||||||
libsodium-wrappers: 0.7.13
|
libsodium-wrappers: 0.7.13
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@discordjs/opus'
|
- '@discordjs/opus'
|
||||||
|
@ -2044,8 +2040,6 @@ snapshots:
|
||||||
|
|
||||||
ip@2.0.0: {}
|
ip@2.0.0: {}
|
||||||
|
|
||||||
ip@2.0.1: {}
|
|
||||||
|
|
||||||
is-buffer@1.1.6: {}
|
is-buffer@1.1.6: {}
|
||||||
|
|
||||||
is-extglob@2.1.1: {}
|
is-extglob@2.1.1: {}
|
||||||
|
@ -2069,7 +2063,7 @@ snapshots:
|
||||||
node-fetch: 3.3.2
|
node-fetch: 3.3.2
|
||||||
unfetch: 5.0.0
|
unfetch: 5.0.0
|
||||||
|
|
||||||
jintr@2.0.0:
|
jintr@2.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
acorn: 8.11.2
|
acorn: 8.11.2
|
||||||
|
|
||||||
|
@ -2550,9 +2544,9 @@ snapshots:
|
||||||
|
|
||||||
youtube-sr@4.3.11: {}
|
youtube-sr@4.3.11: {}
|
||||||
|
|
||||||
youtubei.js@10.2.0:
|
youtubei.js@10.3.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
jintr: 2.0.0
|
jintr: 2.1.1
|
||||||
tslib: 2.6.2
|
tslib: 2.6.2
|
||||||
undici: 5.27.2
|
undici: 5.27.2
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue