docker added
This commit is contained in:
parent
a11654d6f8
commit
62e7283f47
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# Use an official Golang runtime as a parent image
|
||||
FROM golang:latest
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR .
|
||||
|
||||
COPY . .
|
||||
|
||||
# Download and install any required dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Build the Go app
|
||||
RUN go build .
|
||||
|
||||
# Define the command to run the app when the container starts
|
||||
CMD ["./kleincordBot"]
|
||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
||||
version: '3.8'
|
||||
name: kleincord
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: kleincord
|
||||
restart: unless-stopped
|
||||
@ -16,7 +16,7 @@ func ReadBackCommand(data discordgo.ApplicationCommandInteractionData, s *discor
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
services.HandleError(err)
|
||||
services.HandleError(err, s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,6 @@ func Test1Command(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
services.HandleError(err)
|
||||
services.HandleError(err, s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,6 @@ func DeleteCommand(data discordgo.ApplicationCommandInteractionData, s *discordg
|
||||
Content: strconv.Itoa(len(messages)) + " Message deleted",
|
||||
})
|
||||
if err != nil {
|
||||
services.HandleError(err)
|
||||
services.HandleError(err, s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ func MessageTest(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
})
|
||||
if err != nil {
|
||||
services.HandleError(err)
|
||||
services.HandleError(err, s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ func MessageTest2(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
Type: discordgo.EmbedTypeArticle,
|
||||
})
|
||||
if err != nil {
|
||||
services.HandleError(err)
|
||||
services.HandleError(err, s)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
package services
|
||||
|
||||
func HandleError(err error) {
|
||||
import (
|
||||
"github.com/bwmarrin/discordgo"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func HandleError(err error, s *discordgo.Session) {
|
||||
s.ChannelMessageSendComplex(strconv.Itoa(1236038688627101749), &discordgo.MessageSend{
|
||||
Content: "@here",
|
||||
Embed: &discordgo.MessageEmbed{
|
||||
Title: "Error",
|
||||
Color: 0xff0000,
|
||||
Fields: []*discordgo.MessageEmbedField{
|
||||
{
|
||||
Value: "```" + err.Error() + "```",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user