public CommandHandlerService(DiscordSocketClient client, CustomCommandService commands, IServiceProvider services, GuildAccountService accounts)
 {
     _commands = commands;
     _client   = client;
     _services = services;
     _accounts = accounts;
 }
Esempio n. 2
0
        public static async Task ProcessCustomCommand(ICommandContext context, Guild sguild)
        {
            if (sguild is null)
            {
                return;
            }

            using var Database = new SkuldDbContextFactory().CreateDbContext();

            if (sguild is not null)
            {
                GuildModules modules;
                if (!Database.Modules.Any(x => x.Id == sguild.Id))
                {
                    Database.Modules.Add(new GuildModules
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                modules = Database.Modules.Find(sguild.Id);

                if (modules.Custom)
                {
                    await CustomCommandService.HandleCustomCommandAsync(context, SkuldApp.Configuration);
                }
            }
        }
Esempio n. 3
0
        public static async Task HandleSideTasksAsync(ICommandContext context)
        {
            using var Database = new SkuldDbContextFactory().CreateDbContext();

            Guild sguild = null;

            if (context.Guild != null)
            {
                sguild = await
                         Database.InsertOrGetGuildAsync(context.Guild)
                         .ConfigureAwait(false);
            }

            if (sguild != null)
            {
                if (!Database.Features.Any(x => x.Id == sguild.Id))
                {
                    Database.Features.Add(new GuildFeatures
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                GuildFeatures features = Database.Features.Find(sguild.Id);
                if (features.Experience)
                {
                    _ = Task.Run(() => ExperienceService.HandleExperienceAsync(context));
                }

                if (!Database.Modules.Any(x => x.Id == sguild.Id))
                {
                    Database.Modules.Add(new GuildModules
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                GuildModules modules;
                if (!Database.Modules.Any(x => x.Id == sguild.Id))
                {
                    Database.Modules.Add(new GuildModules
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                modules = Database.Modules.Find(sguild.Id);

                if (modules.Custom)
                {
                    _ = Task.Run(() => CustomCommandService.HandleCustomCommandAsync(context, SkuldApp.Configuration));
                }
            }
        }
Esempio n. 4
0
 public BotClient(CustomCommandService commands = null, DiscordSocketClient client = null)
 {
     _client = client ?? new DiscordSocketClient(new DiscordSocketConfig
     {
         LogLevel            = LogSeverity.Info,
         AlwaysDownloadUsers = true,
         MessageCacheSize    = 1000
     });
     _commands = commands ?? new CustomCommandService(new CustomCommandServiceConfig
     {
         CaseSensitiveCommands = false,
         LogLevel           = LogSeverity.Info,
         BotInviteIsPrivate = true,
         RepositoryUrl      = "https://github.com/Galaxy-Life-Reborn/GLRBot"
     });
 }
 public CommandPermissionService(CustomCommandService commands)
 {
     _commands = commands;
 }
 public GuildAccountService(LiteDBHandler storage, CustomCommandService commands)
 {
     _storage  = storage;
     _commands = commands;
 }