Exemplo n.º 1
0
 public ManageCustomCommand(IConfiguration configuration, IRepository <CustomCommand> customCommandRepository, IList <ContinuedCommand> continuedCommands, DiscordGuildMessageContext msgContext)
 {
     _customCommandRepository = customCommandRepository;
     _continuedCommands       = continuedCommands;
     _msgContext = msgContext;
     _prefix     = configuration["CommandPrefix"].Single();
 }
Exemplo n.º 2
0
 public ContinuedCommand(Func <IServiceProvider, Task> command, DiscordGuildMessageContext context)
 {
     Command   = command;
     CreatedAt = DateTime.UtcNow;
     User      = context.Author;
     Channel   = context.Channel;
     Guild     = context.Guild;
 }
Exemplo n.º 3
0
 public HelpCommand(CommandCache commandCache, RoleService roleService, IRepository <CustomCommand> customCommandRepository, IConfiguration configuration, DiscordGuildMessageContext msgContext)
 {
     _commandCache            = commandCache;
     _roleService             = roleService;
     _customCommandRepository = customCommandRepository;
     _msgContext = msgContext;
     _prefix     = configuration["CommandPrefix"].Single();
 }
Exemplo n.º 4
0
        public CmdService(IConfiguration configuration, BotDbContext context, CommandCache commandCache, RoleService roleService, ILogger <CmdService> logger, IServiceProvider serviceProvider, DiscordGuildMessageContext msgContext, IRepository <CustomCommand> customCommandRepository)
        {
            _context                 = context;
            _commandCache            = commandCache;
            _roleService             = roleService;
            _logger                  = logger;
            _msgContext              = msgContext;
            _customCommandRepository = customCommandRepository;
            _prefix                  = configuration["CommandPrefix"].Single();
            var commands = new List <ICommand>();

            var commandTypes = _commandCache.GetTypes();

            foreach (var type in commandTypes)
            {
                var service = (ICommand)serviceProvider.GetRequiredService(type);
                commands.Add(service);
            }

            _commands = commands;
        }
Exemplo n.º 5
0
 public SetMotdCommand(IList <ContinuedCommand> continuedCommands, DiscordGuildMessageContext msgContext)
 {
     _continuedCommands = continuedCommands;
     _msgContext        = msgContext;
 }
Exemplo n.º 6
0
 public bool Match(DiscordGuildMessageContext context)
 {
     return(context.Author.Id == User.Id && context.Channel.Id == Channel.Id &&
            context.Guild.Id == Guild.Id);
 }