Skip to content

Commit

Permalink
Merge pull request #724 from appujet/beta-v5
Browse files Browse the repository at this point in the history
Beta v5
  • Loading branch information
appujet authored Sep 25, 2024
2 parents a671076 + 7d91283 commit 491ea1e
Show file tree
Hide file tree
Showing 147 changed files with 8,503 additions and 8,726 deletions.
43 changes: 18 additions & 25 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
TOKEN= "" # Your bot token.
CLIENT_ID= "" # Your bot's client ID (If this value is left blank, bots cannot be invited using /invite or /about commands.).
DEFAULT_LANGUAGE= "EnglishUS" # Default language for bot
PREFIX= "!" # Your prefix.
OWNER_IDS= ["",""] # Your discord id (You can add multiple ids.).
GUILD_ID= "" # Your server ID (If you want to use the bot for a single server).
TOPGG= "" # Your Top.gg API key. Obtain this from https://top.gg
KEEP_ALIVE= "false" # true for keep alive in https://replit.com
LOG_CHANNEL_ID= "" # If you enter this, you will be able to receive the status of Lavalink nodes and guild join/leave logs through the corresponding channel.
LOG_COMMANDS_ID= "" # The channel ID where command usage logs will be sent.
BOT_STATUS= "online" # Your bot status (online, dnd, idle, invisible or offline).
BOT_ACTIVITY_TYPE= 0 # Activity type is a number from 0 to 5. See more here: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types
BOT_ACTIVITY=" Lavamusic" # Your bot activity.
DATABASE_URL= "" # Your database url (If you want to use sqlite, then you can leave it blank.).
AUTO_NODE=" false" # true for auto node. It is given from lavainfo-api (https://lavainfo-api.deno.dev).
SEARCH_ENGINE= "YouTubeMusic" # Search engine to be used when playing the song. You can use: YouTube, YouTubeMusic, SoundCloud, Spotify, Apple, Deezer, Yandex and JioSaavn
MAX_PLAYLIST_SIZE= "100" # Max playlist size.
MAX_QUEUE_SIZE= "100" # Max queue size.
GENIUS_API= "" # Sign up and get your own api at (https://genius.com/) to fetch your lyrics (CLIENT TOKEN)

# Configuration for multiple Lavalink servers
LAVALINK_SERVERS = '[
{"url":"localhost:2333","auth":"youshallnotpass","name":"Local Node","secure":false},
{"url":"localhost:2333","auth":"youshallnotpass2","name":"Another Node","secure":false}
]'
TOKEN="" # Your bot token.
CLIENT_ID="" # Your bot's client ID (If this value is left blank, bots cannot be invited using /invite or /about commands.).
DEFAULT_LANGUAGE="EnglishUS" # Default language for bot
PREFIX="!" # Your prefix.
OWNER_IDS=["",""] # Your discord id (You can add multiple ids.).
GUILD_ID="" # Your server ID (If you want to use the bot for a single server).
TOPGG="" # Your Top.gg API key. Obtain this from https://top.gg
KEEP_ALIVE="false" # true for keep alive in https://replit.com
LOG_CHANNEL_ID="" # If you enter this, you will be able to receive the status of Lavalink nodes and guild join/leave logs through the corresponding channel.
LOG_COMMANDS_ID="" # The channel ID where command usage logs will be sent.
BOT_STATUS="online" # Your bot status (online, dnd, idle, invisible or offline).
BOT_ACTIVITY_TYPE=0 # Activity type is a number from 0 to 5. See more here: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-types
BOT_ACTIVITY=="Lavamusic" # Your bot activity.
DATABASE_URL="" # Your database url (If you want to use sqlite, then you can leave it blank.).
AUTO_NODE=="false" # true for auto node. It is given from lavainfo-api (https://lavainfo-api.deno.dev).
SEARCH_ENGINE="YouTubeMusic" # Search engine to be used when playing the song. You can use: YouTube, YouTubeMusic, SoundCloud, Spotify, Apple, Deezer, Yandex and JioSaavn
GENIUS_API="" # Sign up and get your own api at (https://genius.com/) to fetch your lyrics (CLIENT TOKEN)
NODES=[{"id":"Local Node","host":"localhost","port":2333,"authorization":"youshallnotpass"}]
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ body:
description: "Specify the version of Node.js that you are using."
placeholder: "e.g., 14.17.0"
validations:
required: false

required: true
- type: input
id: java-version
attributes:
label: "java version"
description: "Specify the version of Java that you are using."
placeholder: "e.g., 17"
validations:
required: false
required: true

- type: input
id: app-version
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ body:
description: "Add any other context or screenshots that could help explain your feature request."
placeholder: "Additional context, links, or references"
validations:
required: false
required: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

bun.lockb
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down
6 changes: 6 additions & 0 deletions .hintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["development"],
"hints": {
"typescript-config/consistent-casing": "off"
}
}
39 changes: 14 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@ FROM node:22 AS builder

WORKDIR /opt/lavamusic/

# Copy package files and install dependencies
# Copy only package files and install dependencies
COPY package*.json ./
RUN npm install --legacy-peer-deps

# Install necessary tools and update npm
RUN apt-get update && apt-get install -y openssl git \
&& npm install -g npm@latest
RUN npm install
RUN npm config set global --legacy-peer-deps

# Copy source code
# Copy source code and configuration
COPY . .

# Copy tsconfig.json
COPY tsconfig.json ./
# Copy prisma
COPY prisma ./prisma
# Generate Prisma client
RUN npx prisma db push
# Build TypeScript
RUN npm run build
# Generate Prisma client and build TypeScript
RUN npx prisma db push && \
npm run build

# Stage 2: Create production image
FROM node:22-slim
Expand All @@ -32,18 +22,20 @@ ENV NODE_ENV=production
WORKDIR /opt/lavamusic/

# Install necessary tools
RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y --no-install-recommends openssl && \
rm -rf /var/lib/apt/lists/*

# Copy compiled code and other necessary files from the builder stage
# Copy compiled code and necessary files from the builder stage
COPY --from=builder /opt/lavamusic/dist ./dist
COPY --from=builder /opt/lavamusic/src/utils/LavaLogo.txt ./src/utils/LavaLogo.txt
COPY --from=builder /opt/lavamusic/prisma ./prisma
COPY --from=builder /opt/lavamusic/scripts ./scripts
COPY --from=builder /opt/lavamusic/package*.json ./
COPY --from=builder /opt/lavamusic/locales ./locales

# Install production dependencies
COPY --from=builder /opt/lavamusic/package*.json ./
RUN npm install --omit=dev

# Generate Prisma client
RUN npx prisma generate
RUN npx prisma db push

Expand All @@ -53,12 +45,9 @@ RUN rm -rf /opt/lavamusic/application.yml && \

# Run as non-root user
RUN addgroup --gid 322 --system lavamusic && \
adduser --uid 322 --system lavamusic

# Change ownership of the folder
RUN chown -R lavamusic:lavamusic /opt/lavamusic/
adduser --uid 322 --system lavamusic && \
chown -R lavamusic:lavamusic /opt/lavamusic/

# Switch to the appropriate user
USER lavamusic

CMD ["node", "dist/index.js"]
14 changes: 7 additions & 7 deletions Lavalink/example.application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ plugins:
spotify:
clientId: "your client id"
clientSecret: "your client secret"
spDc: "your sp dc cookie" # the sp dc cookie used for accessing the spotify lyrics api
# spDc: "your sp dc cookie" # the sp dc cookie used for accessing the spotify lyrics api
countryCode: "US" # the country code you want to use for filtering the artists top tracks. See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
playlistLoadLimit: 6 # The number of pages at 100 tracks each
albumLoadLimit: 6 # The number of pages at 50 tracks each
Expand Down Expand Up @@ -101,15 +101,15 @@ lavalink:
- dependency: "com.github.appujet:jiosaavn-plugin:0.1.7"
repository: "https://jitpack.io"
- dependency: "com.dunctebot:skybot-lavalink-plugin:1.7.0"
snapshot: false # set to true if you want to use snapshot builds.
snapshot: false # set to true if you want to use snapshot builds
- dependency: "com.github.topi314.lavasearch:lavasearch-plugin:1.0.0"
snapshot: false # set to true if you want to use snapshot builds.
snapshot: false # set to true if you want to use snapshot builds
- dependency: "com.github.topi314.lavasrc:lavasrc-plugin:4.2.0"
snapshot: false # set to true if you want to use snapshot builds.
snapshot: false # set to true if you want to use snapshot builds
- dependency: "com.github.topi314.sponsorblock:sponsorblock-plugin:3.0.1"
snapshot: false # set to true if you want to use snapshot builds.
- dependency: "dev.lavalink.youtube:youtube-plugin:1.7.2"
snapshot: false # set to true if you want to use snapshot builds.
snapshot: false # set to true if you want to use snapshot builds
- dependency: "dev.lavalink.youtube:youtube-plugin:1.8.0"
snapshot: false # set to true if you want to use snapshot builds
pluginsDir: './plugins'
server:
password: "youshallnotpass"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</a>

<h1 align="center">Lavamusic</h1>
<p align="center">Lavamusic is a Discord music bot that uses Discord.js, Shoukaku, and TypeScript.
<p align="center">Lavamusic is a Discord music bot that uses Discord.js, lavalink-client, and TypeScript.
<br />
<br />
<a href="https://discord.com/oauth2/authorize?client_id=875635121770889257&scope=bot+applications.commands&permissions=8">Invite Lavamusic</a>
Expand All @@ -32,7 +32,7 @@
- User-friendly and Easy to Use
- Highly Configurable
- Customizable Prefix
- Multilingual support
- Multilingual support [Here](/Translation.md)
- Hybrid Command Handling (Slash and Normal Commands)
- Developed using TypeScript and Discord.js v14
- Advanced Music System
Expand Down Expand Up @@ -242,4 +242,4 @@ Thanks go to these wonderful people:
[license-shield]: https://img.shields.io/github/license/appujet/lavamusic.svg?style=for-the-badge
[license-url]: https://github.com/appujet/lavamusic/blob/master/LICENSE
[support-server]: https://discord.gg/PMpJnJaHmy
[support-shield]: https://img.shields.io/discord/942117923001098260.svg?style=for-the-badge&logo=discord&colorB=7289DA
[support-shield]: https://img.shields.io/discord/942117923001098260.svg?style=for-the-badge&logo=discord&colorB=7289DA
21 changes: 0 additions & 21 deletions SECURITY.md

This file was deleted.

61 changes: 30 additions & 31 deletions Translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
2. 📋 Copy the contents of the `EnglishUS.json` file into the new file.
3. 🌐 Translate the strings in the new file to the desired language.


### 📚 Available Translations

- [x] English (US) - `EnglishUS.json` (Default)
Expand Down Expand Up @@ -42,7 +41,6 @@
- [ ] Ukrainian - `Ukrainian.json` (Not Started)
- [x] Vietnamese - `Vietnamese.json` [by @nhutlamm](https://github.com/nhutlamm) (Ai Translation - Not Accurate)


## 📚 How to Use the Translations

1. 📁 Create a new file in the `locales` directory with the name of the language in the format `language_code.json`. For example, `EnglishUS.json` for English, `SpanishES.json` for Spanish, etc.
Expand All @@ -51,8 +49,8 @@

3. 🌐 Translate the strings in the new file to the desired language.


## Have a language to contribute? 🎉

- Fork the repository.
- Add the translation file in the `locales` directory.
- Create a pull request with the changes.
Expand All @@ -65,60 +63,61 @@
- **Do not** add any new keys to the translation JSON file.
- **Do not** add any new directories to the repository.



## 📝 Translation JSON Structure

The translation JSON file should be structured as follows:

```json
{
"category": {
"command": {
"description": "Description of the command.",
"content": "Command content.",
"key": "value"
}
}
"category": {
"command": {
"description": "Description of the command.",
"content": "Command content.",
"key": "value"
}
}
}
```

### Example Translation JSON

**EnglishUS:**

```json
{
"cmd": {
"ping": {
"description": "Shows the bot's ping.",
"content": "Pinging...",
"bot_latency": "Bot Latency",
"api_latency": "API Latency",
"requested_by": "Requested by {author}"
}
}
"cmd": {
"ping": {
"description": "Shows the bot's ping.",
"content": "Pinging...",
"bot_latency": "Bot Latency",
"api_latency": "API Latency",
"requested_by": "Requested by {author}"
}
}
}
```

**Hindi:**

```json
{
"cmd": {
"ping": {
"description": "बॉट का पिंग दिखाता है।",
"content": "पिंगिंग...",
"bot_latency": "पिंगिंग...",
"api_latency": "एपीआई लेटेंसी",
"requested_by": "{author} द्वारा अनुरोधित"
}
}
"cmd": {
"ping": {
"description": "बॉट का पिंग दिखाता है।",
"content": "पिंगिंग...",
"bot_latency": "पिंगिंग...",
"api_latency": "एपीआई लेटेंसी",
"requested_by": "{author} द्वारा अनुरोधित"
}
}
}
```

### Formatting Tags for i18n NPM
To ensure `{}` are not removed during translations, use the format tags: `["{", "}"]`.

To ensure `{}` are not removed during translations, use the format tags: `["{", "}"]`.

## 📚 Resources

- [i18n NPM](https://www.npmjs.com/package/i18n)
- [Discord Developer Portal - Locales](https://discord.com/developers/docs/reference#locales)
Loading

0 comments on commit 491ea1e

Please sign in to comment.