Skip to content

Not able to get members in a voice channel, what am I doing wrong? #1273

Answered by koo04
koo04 asked this question in Q&A
Discussion options

You must be logged in to vote

I finally answered my own question. Will put the code here and will likely make a snippet to reference, later:

package main

import (
	"fmt"
	"time"

	"github.com/bwmarrin/discordgo"
)

func testCommandHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
	guild, err := s.State.Guild(i.GuildID)
	if err != nil {
		panic(err)
	}

	if err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
		Type: discordgo.InteractionResponseChannelMessageWithSource,
		Data: &discordgo.InteractionResponseData{
			Flags:   discordgo.MessageFlagsEphemeral,
			Content: fmt.Sprintf("just a test: %d", len(guild.VoiceStates)),
		},
	}); err != nil {
		panic(err)
	}
}

func startBot() {
	

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by koo04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant