Skip to content

Commit cbebb2a

Browse files
init:2
1 parent 3084d5f commit cbebb2a

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ fmt:
3838
.PHONY: build
3939
build:
4040
go build -ldflags="-w -s" -o bin/app ./...
41+
42+
## run: run locally
43+
.PHONY: run
44+
run:
45+
go run ./...

internal/pkg/commandHandlers/commandHandlers.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ import (
1111

1212
var (
1313
CommandHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
14+
// "get-issues": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
15+
// // this is where the call to your broker is made
16+
// // after the broker call is returned
17+
18+
// s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
19+
// Type: discordgo.InteractionResponseChannelMessageWithSource,
20+
// Data: &discordgo.InteractionResponseData{
21+
// Content: "Hey there! Congratulations, this is the list of all issues",
22+
// },
23+
// })
24+
// },
1425
"basic-command": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
1526
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
1627
Type: discordgo.InteractionResponseChannelMessageWithSource,

internal/pkg/commands/commands.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ import "github.com/bwmarrin/discordgo"
55
var (
66
integerOptionMinValue = 1.0
77
Commands = []*discordgo.ApplicationCommand{
8+
// {
9+
// Name: "basic-command",
10+
// Description: "Command to get all the issues of a repository",
11+
// Options: []*discordgo.ApplicationCommandOption{
12+
13+
// {
14+
// Type: discordgo.ApplicationCommandOptionString,
15+
// Name: "Repository",
16+
// Description: "Name of the repository",
17+
// Required: true,
18+
// },
19+
// },
20+
// },
821
{
922
Name: "basic-command",
1023
// All commands and options must have a description

internal/pkg/discordCommandInterface/dci.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package discordCommandInterface
33
import (
44
"context"
55
"flag"
6+
"fmt"
67
"log"
78
"os"
89
"os/signal"
@@ -16,7 +17,6 @@ import (
1617
// Bot parameters
1718
var (
1819
GuildID = flag.String("guild", "", "Test guild ID. If not passed - bot registers commands globally")
19-
BotToken = flag.String("token", "", "Bot access token")
2020
RemoveCommands = flag.Bool("rmcmd", true, "Remove all commands after shutdowning or not")
2121
)
2222

@@ -27,7 +27,7 @@ func InitializeDiscordServer(c context.Context) (*discordgo.Session, error) {
2727

2828
botToken := c.Value(constants.BotTokenHeader)
2929
var err error
30-
s, err = discordgo.New("Bot " + botToken)
30+
s, err = discordgo.New("Bot " + fmt.Sprint(botToken))
3131
if err != nil {
3232
log.Fatalf("Invalid bot parameters: %v", err)
3333
}
@@ -87,4 +87,6 @@ func ReadWriteMethod(ctx context.Context, s *discordgo.Session) error {
8787
}
8888

8989
log.Println("Gracefully shutting down.")
90+
91+
return nil
9092
}

0 commit comments

Comments
 (0)