Skip to content

Commit

Permalink
Fix gateway intents
Browse files Browse the repository at this point in the history
  • Loading branch information
bman46 committed Nov 28, 2022
1 parent 4d9e5d3 commit 1f05549
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Instagram Reels Bot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Program
private readonly IConfiguration _config;
private DiscordShardedClient _client;
private InteractionService _interact;
private DiscordSocketConfig DiscordSocketConfig;

/// <summary>
/// Main entry point for the program
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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<DiscordShardedClient>()
.AddSingleton<DiscordShardedClient>(new DiscordShardedClient(DiscordSocketConfig))
.AddSingleton<CommandService>()
.AddSingleton<CommandHandler>()
.AddSingleton<InteractionService>()
Expand Down

0 comments on commit 1f05549

Please sign in to comment.