private async Task StartBots() { while (!_guildsAvailable) { await Task.Delay(100); } Console.WriteLine("Guilds available. Starting bots"); try { _sankakuBot = new SankakuBot(this._client); // Is Seperate Thread _sankakuBot.Initialize(); _waifujoiBot = new WaifuJOIBot(this._client); // Is Seperate Thread await _waifujoiBot.Start(); _eventBot = new EventBot(this._client, _cancellationTokenSource.Token); // Is Seperate Thread await _eventBot.Start(); _pornhubBot = new PornhubBot(this._client, _cancellationTokenSource.Token); // Is Seperate Thread _helpBot = new HelpBot(this._client); // Is Seperate Thread this.SetCommands(); } catch (Exception e) { Console.Error.WriteLine(e); } }
public async Task MainAsync(string[] args) { this.SetConfig(args); _sankakuBot = new SankakuBot(this._client); // Is Seperate Thread _sankakuBot.Initialize(); _waifujoiBot = new WaifuJOIBot(this._client); // Is Seperate Thread await _waifujoiBot.Start(); this.SetCommands(); this.CreateFolders(); await this._client.ConnectAsync(); this._client.MessageCreated += this.ClientMessageCreated; this._client.GuildMemberUpdated += this.ClientGuildMemberUpdated; await this._client.UpdateStatusAsync(new DiscordGame("Feetsies"), UserStatus.Online); // TODO: Looks weird, cause unused. try { PornhubBot pornhubBot = new PornhubBot(this._client); // Is Seperate Thread HelpBot helpBot = new HelpBot(this._client); // Is Seperate Thread } catch (Exception e) { Console.Error.WriteLine(e); } await AnnounceVersion(); await Task.Run(() => { var exit = false; while (!exit) { string command = Console.ReadLine(); switch (command) { case "stop": case "exit": case "x": PornhubBot.Exit = true; exit = true; break; } } }); await this._client.DisconnectAsync(); }
public async Task MainAsync() { this.SetConfig(); this.SetCommands(); this.CreateFolders(); await this.client.ConnectAsync(); this.client.Ready += this.OnReadyAsync; this.client.MessageCreated += this.ClientMessageCreated; this.client.MessageReactionAdded += this.ClientMessageReactionAdded; this.client.GuildMemberUpdated += this.ClientGuildMemberUpdated; this.conn = new SqlConnection(Config.DatabaseConnectionString); await this.conn.OpenAsync(); await this.client.UpdateStatusAsync(new DiscordGame("Feetsies"), UserStatus.Online); // TODO: Looks weird, cause unused. SankakuBot sankakuBot = new SankakuBot(this.client); PornhubBot pornhubBot = new PornhubBot(this.client); HelpBot helpBot = new HelpBot(this.client); this.tmblrBot = new TumblrBot(this.client); var exit = false; while (!exit) { string command = Console.ReadLine(); switch (command) { case "stop": case "exit": case "x": PornhubBot.Exit = true; exit = true; break; } } await this.client.DisconnectAsync(); }
public async Task BoostDeepLearningFeetPics(CommandContext ctx) { var context = new DiscordContext(); var minTime = DateTime.Now - TimeSpan.FromHours(6); var boosts = context.Boost.Where(b => b.Date > minTime && (b.Channel == null || b.Channel == Convert.ToInt64(ctx.Channel.Id))); if (await boosts.CountAsync() > 4) { await ctx.RespondAsync($"You have to wait before boosting again. Next one is available in {(TimeSpan.FromHours(6) - (DateTime.Now - boosts.Last().Date)).TotalMinutes} minutes."); return; } var sabrinaSettings = await context.SabrinaSettings.FindAsync(Convert.ToInt64(ctx.Guild.Id)); if (sabrinaSettings.FeetChannel == null) { sabrinaSettings.FeetChannel = Convert.ToInt64(ctx.Channel.Id); } var channel = await ctx.Client.GetChannelAsync(Convert.ToUInt64(sabrinaSettings.FeetChannel)); if (sabrinaSettings.FeetChannel.Value != Convert.ToInt64(ctx.Channel.Id)) { await ctx.RespondAsync($"You cannot issue this command from this Channel. Please use {channel.Mention}"); return; } var picsToPost = Helpers.RandomGenerator.RandomInt(2, 5); Parallel.For(0, picsToPost, async i => { await Task.Run(async() => await SankakuBot.PostRandom(channel, i)); //await SankakuBot.PostPrediction(Convert.ToInt64(ctx.User.Id) ,channel); }); }
public Feet(SankakuBot sBot, WaifuJOIBot wjBot) { _sankakuBot = sBot; _waifujoiBot = wjBot; }