From 1f055496f79929ffe2012ddd30d2448c7390dd0c Mon Sep 17 00:00:00 2001 From: Brendan McShane Date: Mon, 28 Nov 2022 17:08:42 -0500 Subject: [PATCH] Fix gateway intents --- Instagram Reels Bot/Program.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Instagram Reels Bot/Program.cs b/Instagram Reels Bot/Program.cs index 0badb21..93a8b4f 100644 --- a/Instagram Reels Bot/Program.cs +++ b/Instagram Reels Bot/Program.cs @@ -18,6 +18,7 @@ class Program private readonly IConfiguration _config; private DiscordShardedClient _client; private InteractionService _interact; + private DiscordSocketConfig DiscordSocketConfig; /// /// Main entry point for the program @@ -89,6 +90,11 @@ public Program() public async Task MainAsync() { + // Setup Gateway intents + DiscordSocketConfig = new DiscordSocketConfig() + { + GatewayIntents = GatewayIntents.MessageContent | GatewayIntents.Guilds | GatewayIntents.GuildEmojis | GatewayIntents.GuildIntegrations | GatewayIntents.GuildWebhooks | GatewayIntents.GuildMessages | GatewayIntents.GuildMessageReactions | GatewayIntents.GuildMessageTyping | GatewayIntents.DirectMessages | GatewayIntents.DirectMessageReactions | GatewayIntents.DirectMessageTyping + }; // call ConfigureServices to create the ServiceCollection/Provider for passing around the services using (var services = ConfigureServices()) { @@ -178,7 +184,7 @@ private ServiceProvider ConfigureServices() // the config we build is also added, which comes in handy for setting the command prefix! return new ServiceCollection() .AddSingleton(_config) - .AddSingleton() + .AddSingleton(new DiscordShardedClient(DiscordSocketConfig)) .AddSingleton() .AddSingleton() .AddSingleton()