Hello! im having an issue with sending a command, I have tried changing the perms and it still hasnt worked. Here is the SS and code.
https://cdn.discordapp.com/attachments/1227694143514607639/1239777306663194695/image.png?ex=66442817&is=6642d697&hm=b38a77a57b2fe19109195ad05e8d01610afc9d147dce7c33fec0b5aef9c50c65&
#401 unauth.
9 messages · Page 1 of 1 (latest)
token, err := os.Open("./config.json")
if err != nil {
log.Fatal(err)
}
defer token.Close()
var config botConfig
decoder := json.NewDecoder(token)
err = decoder.Decode(&config)
if err != nil {
log.Fatal(err)
}
discord, err := discordgo.New(config.Token)
if err != nil {
log.Fatal(err)
}
discord.AddHandler(message)
err = discord.Open()
if err != nil {
log.Fatal(err)
}
discord.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsAll)
fmt.Println("Bot started on ")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-sc
discord.Close()
}
func message(discord *discordgo.Session, message *discordgo.MessageCreate) {
if message.Author.ID == discord.State.User.ID {
return
}
switch {
case strings.HasPrefix(message.Content, "!help"):
fmt.Println("saw")
_, err := discord.ChannelMessageSend(message.ChannelID, "Yo")
if err != nil {
log.Fatal(err)
}
fmt.Println("Sent")
}
}
you want to call discordgo.New with "Bot {token}"
i forgot a few the very top
my b
there we go
1 min reading docs
I see what you mean, thank you! @zinc timber
👍