수정
This commit is contained in:
@@ -8,6 +8,7 @@ import { getGuildById, getVoiceChannelById } from "../utils/music/Channel";
|
||||
import { channelJoin } from "../commands/join";
|
||||
import { GuildPlayer } from "./GuildPlayer";
|
||||
import { Guild, VoiceChannel } from "discord.js";
|
||||
import { SongItem } from "../types/Track";
|
||||
|
||||
type SubAction =
|
||||
"search" |
|
||||
@@ -47,8 +48,17 @@ export class RedisClient {
|
||||
|
||||
if (data.action === "search") {
|
||||
const resultKey = `search:${data.requestId}`;
|
||||
const results = await Spotify.getSearchFull(data.query) ?? await YoutubeMusic.getSearchFull(data.query) ?? [];
|
||||
await this.pub.setex(resultKey, 60, JSON.stringify(results));
|
||||
const spotify: SongItem[] = (await Spotify.getSearchFull(data.query) ?? []).slice(0,10);
|
||||
const youtubeMusic: SongItem[] = (await YoutubeMusic.getSearchFull(data.query) ?? []).slice(0,10);
|
||||
const youtubeVideo: SongItem[] = (await lavalinkManager.youtubeSearch(data.query) ?? []).slice(0,10).map((video) => ({
|
||||
videoId: video.info.identifier,
|
||||
url: `https://www.youtube.com/watch?v=${video.info.identifier}`,
|
||||
title: video.info.title,
|
||||
artist: video.info.author,
|
||||
thumbnail: video.info.artworkUrl ?? "",
|
||||
duration: video.info.length,
|
||||
}));
|
||||
await this.pub.setex(resultKey, 60, JSON.stringify({ spotify, youtubeMusic, youtubeVideo }));
|
||||
Logger.log(`[Redis Pub] [setex] 결과 저장: (${resultKey})`);
|
||||
}
|
||||
if (data.action === "player_play") {
|
||||
|
||||
Reference in New Issue
Block a user