Skip to content

Commit

Permalink
Merge pull request #22 from HeesuKim0203/dev/play
Browse files Browse the repository at this point in the history
readme update config update
  • Loading branch information
HeesuKim0203 authored Jan 14, 2024
2 parents e1391ed + 9fabbd0 commit f3532da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@ You must use it with the commands set in the ```BOT_NAME``` mentioned above.
|skip|Skips one song.|
|help|Provides a manual for the commands.|

## Docker Hub

The image file is provided on [Docker hub](https://hub.docker.com/repository/docker/heesu998/discordgo-music-bot/general)!
After pulling it, you can use it by entering the commands in order.

#### Pull docker image
```
docker pull heesu998/discordgo-music-bot
```

#### Running a container
```
sudo docker run -e DISCORD_PUBLIC_KEY=[your_public_key] -e YOUTUBE_PUBLIC_KEY=[your_public_key] --name [container name] heesu998/discordgo-music-bot
```
16 changes: 8 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func init() {
env, err := godotenv.Read("./.env")

if err != nil {
fmt.Printf("Not found .env File : ")
fmt.Printf("It fetches the specified environment variables, not from the .env file.")
fmt.Println("Not found .env File!")
fmt.Println("It fetches the specified environment variables, not from the .env file.")
specifiedEnv()
} else {
envFile(env)
Expand Down Expand Up @@ -103,21 +103,21 @@ func specifiedEnv() {
if discrodToken != "" {
c.discordToken = discrodToken
} else {
panic("Not found in .env file the 'DISCORD_PUBLIC_KEY'!")
panic("Not found the 'DISCORD_PUBLIC_KEY'!")
}

youtubeToken := os.Getenv("YOUTUBE_PUBLIC_KEY")

if youtubeToken != "" {
c.youtubeToken = youtubeToken
} else {
panic("Not found in .env file the 'YOUTUBE_PUBLIC_KEY'!")
panic("Not found the 'YOUTUBE_PUBLIC_KEY'!")
}

queueSize, err := strconv.Atoi(os.Getenv("MUSIC_QUEUE_SIZE"))

if err != nil {
fmt.Println("Not correct format in .env file the 'MUSIC_QUEUE_SIZE'!")
fmt.Println("Not correct format the 'MUSIC_QUEUE_SIZE'!")
fmt.Println("Use the default for 'MUSIC_QUUE_SIZE'.")
c.queueSize = 10
} else {
Expand All @@ -127,7 +127,7 @@ func specifiedEnv() {
musicDuration, err := strconv.Atoi(os.Getenv("MUSIC_DURATION"))

if err != nil {
fmt.Println("Not correct format in .env file the 'MUSIC_DURATION'!")
fmt.Println("Not correct format the 'MUSIC_DURATION'!")
fmt.Println("Use the default for 'MUSIC_DURATION'.")
c.musicDuration = 480
} else {
Expand All @@ -139,15 +139,15 @@ func specifiedEnv() {
if botName != "" {
c.botName = botName
} else {
fmt.Println("Not found in .env file the 'BOT_NAME'!")
fmt.Println("Not found the 'BOT_NAME'!")
fmt.Println("Use the default for 'BOT_NAME'.")
c.botName = "!music"
}

searchListMax, err := strconv.Atoi(os.Getenv("MAX_MUSIC_SEARCH_LIST"))

if err != nil {
fmt.Println("Not correct format in .env file the 'MAX_MUSIC_SEARCH_LIST'!")
fmt.Println("Not correct format the 'MAX_MUSIC_SEARCH_LIST'!")
fmt.Println("Use the default for 'MAX_MUSIC_SEARCH_LIST'.")
c.searchListMax = 5
} else {
Expand Down

0 comments on commit f3532da

Please sign in to comment.