public CommandHandler(DiscordSocketClient client, CommandService commands, ISettings settings, IServiceProvider serviceProvider, ILogger <CommandHandler> logger, IServerService servers, BannerImageService bannerImageService, IAutoRoleService autoRoleService, IProfanityRepository profanityRepository, IApiService apiService, IWelcomeMessageRepository welcomeMessageRepository, IPartMessageRepository partMessageRepository, IUserRepository userRepository, IInviteRepository inviteRepository, IServerInviteRepository serverInviteRepository, IServerRepository serverRepository) { _client = client; _commands = commands; _settings = settings; _serviceProvider = serviceProvider; _logger = logger; _servers = servers; _bannerImageService = bannerImageService; _autoRoleService = autoRoleService; _profanityRepository = profanityRepository; _apiService = apiService; _welcomeMessageRepository = welcomeMessageRepository; _partMessageRepository = partMessageRepository; _userRepository = userRepository; _inviteRepository = inviteRepository; _serverInviteRepository = serverInviteRepository; _serverRepository = serverRepository; _client.MessageReceived += OnMessageReceived; _client.UserJoined += OnUserJoined; _client.ReactionAdded += OnReactionAdded; _client.MessageUpdated += OnMessageUpated; _client.UserLeft += OnUserLeft; _client.JoinedGuild += OnJoinedGuild; _client.Ready += OnReady; _client.InviteCreated += OnInviteCreated; _commands.CommandExecuted += OnCommandExecuted; ProfanityHelper.ProfanityRepository = profanityRepository; Task.Run(async() => await MuteHandler.MuteWorker(client)); Task.Run(async() => await PomodoroHandler.PomodoroWorker(client)); }
public async Task Break(int length = 5) { await Context.Channel.TriggerTypingAsync(); _logger.LogInformation("{username}#{discriminator} executed pomodoro shortbreak on {server}/{channel}", Context.User.Username, Context.User.Discriminator, Context.Guild?.Name ?? "DM", Context.Channel.Name); var pom = new Pomodoro { Guild = Context?.Guild as SocketGuild, User = Context?.User as SocketUser, Channel = Context.Channel as SocketChannel, TimerType = PomodoroTimerType.Pomodoro, Task = "your short break", End = DateTime.Now + TimeSpan.FromMinutes(length) }; PomodoroHandler.AddPomodoro(pom); await ReplyAsync($"`Short break ({length} min)` Timer started!"); }
public async Task Start([Summary("length of timer")] int length = 25, [Summary("Task Name")][Remainder] string name = "Pomodoro") { await Context.Channel.TriggerTypingAsync(); _logger.LogInformation("{username}#{discriminator} executed pomodoro start (Length: {length} Name {name}) on {server}/{channel}", Context.User.Username, Context.User.Discriminator, length, name, Context.Guild?.Name ?? "DM", Context.Channel.Name); var pom = new Pomodoro { Guild = Context?.Guild as SocketGuild, User = Context?.User as SocketUser, Channel = Context.Channel as SocketChannel, TimerType = PomodoroTimerType.Pomodoro, Task = name, End = DateTime.Now + TimeSpan.FromMinutes(length) }; PomodoroHandler.AddPomodoro(pom); await ReplyAsync($"`{name}` Timer started!"); }