Fixed some bugs

This commit is contained in:
Choco
2024-07-06 15:27:53 +08:00
parent c7ec2b5159
commit a81541705c
4 changed files with 9 additions and 9 deletions

View File

@@ -106,7 +106,7 @@ class Basic(commands.Cog):
node = voicelink.NodePool.get_node()
if node and node.spotify_client:
tracks: list[voicelink.Track] = await node.spotifySearch(current, requester=interaction.user)
return history_tracks[:5] + [app_commands.Choice(name=f"🎵 {track.author} - {track.title}", value=f"{track.author} - {track.title}") for track in tracks]
return history_tracks[:5] + [app_commands.Choice(name=truncate_string(f"🎵 {track.author} - {track.title}", 100), value=truncate_string(f"{track.author} - {track.title}", 100)) for track in tracks]
@commands.hybrid_command(name="connect", aliases=get_aliases("connect"))
@app_commands.describe(channel="Provide a channel to connect.")

View File

@@ -8,6 +8,7 @@ services:
environment:
- _JAVA_OPTIONS=-Xmx1G
- SERVER_PORT=2333
- LAVALINK_SERVER_PASSWORD=youshallnotpass
volumes:
## Use "./" if you want to create a mount from your current directory (where docker-compose.yml is located)
## Having access to files INSIDE the container is complicated. Mount function is used to have access to certain container files or folders.
@@ -39,15 +40,14 @@ services:
# command: ["mongod", "--oplogSize=1024", "--wiredTigerCacheSizeGB=1", "--auth", "--noscripting"]
vocard:
image: ghcr.io/chocomeow/vocard:v2.6.8
container_name: vocard
volumes:
## Use "./" if you want to create a mount from your current directory (where docker-compose.yml is located)
## Having access to files INSIDE the container is complicated. Mount function is used to have access to certain container files or folders.
## Read more: https://docs.docker.com/storage/bind-mounts/
- ./settings.json:/app/settings.json
env_file:
- .env
build:
dockerfile: ./Dockerfile
depends_on:
lavalink:
condition: service_started

View File

@@ -8,9 +8,9 @@
"mongodb_name": "YOUR_MONGODB_DB_NAME",
"nodes": {
"DEFAULT": {
"host": "127.0.0.1",
"host": "lavalink",
"port": 2333,
"password": "password",
"password": "youshallnotpass",
"secure": false,
"identifier": "DEFAULT"
}

View File

@@ -13,8 +13,8 @@ class Track:
def __init__(self, data: dict, image = None) -> None:
self.name: str = data.get('name', 'Unknown')
self.artists: str = ", ".join(artist["name"] for artist in data.get('artists'))
self.artist_id: list[str] = [artist['id'] for artist in data.get('artists')]
self.artists: str = ", ".join(filter(None, (artist["name"] for artist in data.get('artists'))))
self.artist_id: list[str] = [artist["id"] for artist in data.get('artists')]
self.length: int = data.get('duration_ms')
self.id: str = data.get('id')
self.image: str = images[0]["url"] if (images := data.get("album", {}).get("images")) else image
@@ -55,7 +55,7 @@ class Album:
def __init__(self, data: dict) -> None:
self.name: str = data.get('name', 'Unknown')
self.artists: str = ", ".join(artist["name"] for artist in data.get('artists'))
self.artists: str = ", ".join(filter(None, (artist["name"] for artist in data.get('artists'))))
self.image: str = data["images"][0]["url"]
self.tracks: list[Track] = [Track(track, image=self.image) for track in data["tracks"]["items"]]
self.total_tracks: int = data["total_tracks"]