private static async Task MainAsync(string[] args) { var sc = CommonInitialize.Main(args); // Initialize the ASP.NET service provider and freeze this Task indefinitely. await using var services = ConfigureServices(sc); await CommonInitialize.ConfigureServicesAsync(services); var client = services.GetRequiredService <DiscordSocketClient>(); var db = services.GetRequiredService <DbService>(); var moderationEvents = services.GetRequiredService <ModerationEventService>(); var censusEvents = services.GetRequiredService <CensusEventService>(); var mute = services.GetRequiredService <MuteService>(); var roleRemover = services.GetRequiredService <TimedRoleManager>(); roleRemover.Initialize(); client.ReactionAdded += (message, channel, reaction) => ReactionReceived.HandlerAdd(db, message, channel, reaction); client.ReactionRemoved += (message, channel, reaction) => ReactionReceived.HandlerRemove(db, message, channel, reaction); client.MessageDeleted += moderationEvents.MessageDeleted; client.MessageReceived += moderationEvents.MessageRecieved; client.MessageReceived += message => MessageCache.Handler(db, message); client.MessageReceived += message => ExtraMessageReceived.Handler(client, message); client.GuildMemberUpdated += censusEvents.GuildMemberUpdated; client.UserVoiceStateUpdated += mute.OnVoiceJoin; Log.Information("Prima.Stable logged in!"); await Task.Delay(-1); }
private static async Task MainAsync(string[] args) { var sc = CommonInitialize.Main(); // Initialize the ASP.NET service provider and freeze this Task indefinitely. await using var services = ConfigureServices(sc); await CommonInitialize.ConfigureServicesAsync(services); var client = services.GetRequiredService <DiscordSocketClient>(); var db = services.GetRequiredService <IDbService>(); var censusEvents = services.GetRequiredService <CensusEventService>(); var mute = services.GetRequiredService <MuteService>(); var roleRemover = services.GetRequiredService <TimedRoleManager>(); var ffLogs = services.GetRequiredService <FFLogsClient>(); var web = services.GetRequiredService <WebClient>(); var lodestone = services.GetRequiredService <CharacterLookup>(); var keepClean = services.GetRequiredService <KeepClean>(); var ephemeralPinner = services.GetRequiredService <EphemeralPinManager>(); var templates = services.GetRequiredService <ITemplateProvider>(); keepClean.Initialize(); roleRemover.Initialize(); ephemeralPinner.Initialize(); await ffLogs.Initialize(); client.ReactionAdded += (message, channel, reaction) => ReactionReceived.HandlerAdd(client, db, lodestone, message, channel, reaction); client.ReactionRemoved += (message, channel, reaction) => ReactionReceived.HandlerRemove(db, message, channel, reaction); client.ReactionAdded += (message, _, reaction) => VoteReactions.HandlerAdd(client, db, message, reaction); client.MessageDeleted += (message, channel) => AuditDeletion.Handler(db, client, message, channel); client.MessageReceived += message => ChatCleanup.Handler(db, web, templates, message); client.MessageReceived += message => MessageCache.Handler(db, message); client.MessageReceived += message => TriggerDispatcher.Handler(client, message); client.UserJoined += user => WelcomeCard.Handler(client, templates, user); client.GuildMemberUpdated += censusEvents.GuildMemberUpdated; client.UserVoiceStateUpdated += mute.OnVoiceJoin; client.ButtonExecuted += component => Modmail.Handler(db, component); Log.Information("Prima.Stable logged in!"); await Task.Delay(-1); }