#DiscordSocketClient's 'Guilds' property is empty, even though the bot is within the Discord server

1 messages · Page 1 of 1 (latest)

hard shadow
#

Heya all,

I'm currently writing a small bot & I noticed that - even though my bot is in my local discord server - the 'Guilds' property is empty. Is there a specific permission my bot needs, such that I can get the data from this property? My flow at this point is very basic, simply:

  1. Create the discord client
  2. LoginAsync (awaited)
  3. StartAsync (Awaited)

So, basically:

        var client = _serviceProvider.GetRequiredService<DiscordSocketClient>();
        
        await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("DISCORD_API_KEY_AC_BOT"));
        await client.StartAsync();

where the client is confirmed not to be null.

Thanks!

strong drum
#

welp
make sure you have Guilds intent enabled

hard shadow
#

That's... a good thing to do yeah. Didn't work out tho, the current intents I use are GatewayIntents.MessageContent | GatewayIntents.GuildMessages | GatewayIntents.Guilds. It almost seems as if they're not being fetched at the start

#

Ah hold up, now the discord bot just stays offline. Consider this one solved kek

strong drum