#Proccess has exited with status 0

30 messages · Page 1 of 1 (latest)

worn trail
#

I'm getting this error every time
Process 21408 has exited with status 0

this is my code

package main

import (
    "fmt"
    "log"

    "github.com/bwmarrin/discordgo"
)

func main() {
    s, err := discordgo.New("Bot " + "token") // im using an actual token i just replaced it to send it here

    if err != nil {
        fmt.Println("error creating Discord session:", err)
        return
    }
    defer s.Close()

    s.AddHandler(func(s *discordgo.Session, r *discordgo.Ready) {
        log.Println("Bot is up")
    })

    s.AddHandler(func(s *discordgo.Session, r *discordgo.MessageCreate) {
        log.Println("test")
    })
}

and im using vs code

#

Proccess has exited with status 0

#

its not printing anything either

marble citrus
steady loom
#

exit code 0 means your app exited normally

#

Looking at your code, your main function doesn't have anything to do after adding the MessageCreate handler

marble citrus
river gardenBOT
worn trail
steady loom
#

no

steady loom
#

It is adding the handlers

#

The handlers only get invoked when the corresponding event is fired

marble citrus
#

you're adding handlers, but not opening connection to gateway

worn trail
#

oohh

#

alright

#

ill see what i can do

steady loom
#

the Ready will be invoked once, when you Open the connection to gateway

#

And then it will print "test" every time a message is created in a channel the bot has access to :P

worn trail
#

it worked

#

but i have another problem

#

it doesn't get the message content

#
s.AddHandler(func(s *discordgo.Session, r *discordgo.MessageCreate) {
        log.Printf("Message received: %+v\n", r.Message.Content)
    })```
marble citrus
worn trail
#

these?

marble citrus
#

only message content

river gardenBOT