Compare commits

...

6 Commits

Author SHA1 Message Date
8ddcf31da7 Update readme.md 2024-04-14 23:59:03 +02:00
80a7c19b20 Update readme.md 2024-04-14 23:58:10 +02:00
713715901b Create readme.md 2024-04-14 23:54:26 +02:00
1a3a00f4ed Update README.md 2024-04-14 23:33:44 +02:00
Myx
0673653491 Fix broken lavalink version 2024-04-14 23:02:51 +02:00
a650fd431e Create appsettings.json 2024-04-14 23:01:58 +02:00
8 changed files with 57 additions and 14 deletions

View File

@@ -0,0 +1,33 @@
```mermaid
flowchart TD
PlayHandler --> EnsureConnected
EnsureConnected --> GetPlayer
GetPlayer --> SearchAsync
SearchAsync --> SearchResponse
SearchResponse --> PlayTrack
PlayTrack --> NowPlayingEmbed
```
| Name | Description |
|--|--|
| PlayHandler | Holds the logic for playing songs |
| GetPlayer | Joins voice channel, produces chat resposne |
| EnsureConnected | Makes sure the client is connected |
| SearchAsync | Searches for songs information |
| SearchResponse | Handling possible errors from the response of SearchAsync |
| PlayTrack | Plays the song |
There is also OnTrackEnd, when it get called an attempt is made to play the next song in queue.
Short explaination for some of the variables used:
| Variable | Type | Description |
| --- | --- | --- |
| `_lavaNode` | `LavaNode` | An instance of the `LavaNode` class, used to interact with the LavaLink server for playing music in Discord voice channels. |
| `_client` | `DiscordSocketClient` | An instance of the `DiscordSocketClient` class, used to interact with the Discord API for sending messages, joining voice channels, etc. |
| `_musicEmbed` | `MusicEmbed` | An instance of a custom `MusicEmbed` class, used to create and send embed messages related to the music player's current status. |
| `context` | `SocketSlashCommand` | An instance of the `SocketSlashCommand` class, representing a slash command received from Discord. Used to get information about the command and to respond to it. |
| `player` | `LavaPlayer` | An instance of the `LavaPlayer` class, representing a music player connected to a specific voice channel. Used to play, pause, skip, and queue tracks. |
| `guildMessageIds` | `Dictionary<ulong, List<ulong>>` | A dictionary that maps guild IDs to lists of message IDs. Used to keep track of messages sent by the bot in each guild, allowing the bot to delete its old messages when it sends new ones. |
| `songName` | `string` | A string that represents the name or URL of a song to play. Used to search for and queue tracks. |
| `searchResponse` | `SearchResponse` | An instance of the `SearchResponse` class, representing the result of a search for tracks. Used to get the tracks that were found and queue them in the player. |

13
Bot/appsettings.json Normal file
View File

@@ -0,0 +1,13 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"Token": "discordToken",
"LavaLinkPassword": "youshallnotpass",
"LavaLinkHostname": "127.0.0.1",
"LavaLinkPort": 2333
}

View File

@@ -10,10 +10,12 @@ Lunaris2 is a Discord bot designed to play music in your server's voice channels
## Setup ## Setup
1. Clone the repository. 1. Clone the repo.
2. Install the required packages by running `dotnet restore`. 2. Extract.
3. Build the project using `dotnet build`. 3. If there isn't already a appsettings.json file in there, create one.
4. Run the bot using `dotnet run`. 4. Set the discord bot token. How the file should look (without token): [appsettings.json](https://github.com/Myxelium/Lunaris2.0/blob/master/Bot/appsettings.json)]
5. Make sure you got docker installed. And run the file ``start-services.sh``, make sure you got git-bash installed.
6. Now you can start the project and run the application.
## Usage ## Usage

View File

@@ -1,21 +1,16 @@
server: # REST and WS server server: # REST and WS server
port: 2333 port: 2333
address: 0.0.0.0 address: 0.0.0.0
http2:
enabled: false # Whether to enable HTTP/2 support
plugins: plugins:
# name: # Name of the plugin # name: # Name of the plugin
# some_key: some_value # Some key-value pair for the plugin # some_key: some_value # Some key-value pair for the plugin
# another_key: another_value # another_key: another_value
lavalink: lavalink:
plugins: plugins:
# - dependency: "com.github.example:example-plugin:1.0.0" # required, the coordinates of your plugin # - dependency: "group:artifact:version"
# repository: "https://maven.example.com/releases" # optional, defaults to the Lavalink releases repository by default # repository: "repository"
# snapshot: false # optional, defaults to false, used to tell Lavalink to use the snapshot repository instead of the release repository
# pluginsDir: "./plugins" # optional, defaults to "./plugins"
# defaultPluginRepository: "https://maven.lavalink.dev/releases" # optional, defaults to the Lavalink release repository
# defaultPluginSnapshotRepository: "https://maven.lavalink.dev/snapshots" # optional, defaults to the Lavalink snapshot repository
server: server:
password: "youshallnotpass"
sources: sources:
youtube: true youtube: true
bandcamp: true bandcamp: true

View File

@@ -1,7 +1,7 @@
services: services:
lavalink: lavalink:
# pin the image version to Lavalink v4 # pin the image version to Lavalink v4
image: ghcr.io/lavalink-devs/lavalink:3.7.10 image: ghcr.io/lavalink-devs/lavalink:3.7.11
container_name: lavalink container_name: lavalink
restart: unless-stopped restart: unless-stopped
environment: environment: