예제 #1
0
파일: Program.cs 프로젝트: Damitrix/Sabrina
        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);
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
파일: Content.cs 프로젝트: lasteur/Sabrina
        public override async Task BuildAsync()
        {
            Outcome = Outcome == WheelExtension.Outcome.Task ? WheelExtension.Outcome.Edge : Outcome;

            var denialtext = "please don't break the Bot";

            switch (Outcome)
            {
            case WheelExtension.Outcome.Edge:
                denialtext   = "Then spin again";
                this.Outcome = WheelExtension.Outcome.Edge;
                break;

            case WheelExtension.Outcome.Denial:
                denialtext      = "deny your o****m";
                this.DenialTime = new TimeSpan(8, 0, 0);
                this.Outcome    = WheelExtension.Outcome.Denial;
                break;

            case WheelExtension.Outcome.Ruin:
                denialtext   = "ruin your o****m";
                this.Outcome = WheelExtension.Outcome.Ruin;
                break;

            case WheelExtension.Outcome.O****m:
                denialtext   = "enjoy a full o****m";
                this.Outcome = WheelExtension.Outcome.O****m;
                break;

            case WheelExtension.Outcome.Denial | WheelExtension.Outcome.Edge:
                var chance = Helpers.RandomGenerator.RandomInt(0, 9);
                if (chance < 5)
                {
                    denialtext      = "deny your o****m";
                    this.DenialTime = new TimeSpan(8, 0, 0);
                    this.Outcome    = WheelExtension.Outcome.Denial;
                }
                else
                {
                    denialtext   = "Then spin again. If you cum/ruin, use ``//came`` or ``//ruined``";
                    this.Outcome = WheelExtension.Outcome.Edge;
                }

                break;
            }

            Link link = null;

            if (this.Outcome == WheelExtension.Outcome.Edge)
            {
                Image = _dependencies.WaifuJoiBot.GetRandomPicture();

                HttpClient client   = new HttpClient();
                var        response = client.GetAsync(WaifuJOIBot.GetCreatorUrl(Image.CreatorId)).GetAwaiter().GetResult();
                var        creator  = await MessagePack.MessagePackSerializer.DeserializeAsync <WaifuJoi.Shared.Models.Creator>(
                    await response.Content.ReadAsStreamAsync());

                link = new Link
                {
                    CreatorName = creator.Name,
                    Url         = WaifuJOIBot.GetImageUrl(Image.Id),
                    Type        = Link.ContentType.Picture
                };
            }
            else
            {
                List <Link> links = await Link.LoadAll();

                var randomLinkNr = Helpers.RandomGenerator.RandomInt(0, links.Count);

                if (links.Count <= randomLinkNr)
                {
                    link = new Link()
                    {
                        CreatorName = "Salem forgot to update the Links again...",
                        FileName    = "Salem forgot to update the Links again...",
                        Type        = Link.ContentType.Picture,
                        Url         = "https://Exception.com"
                    };
                }
                else
                {
                    link = links[randomLinkNr];
                }
            }

            var fullSentence = string.Empty;
            var rerollIn     = string.Empty;

            switch (link.Type)
            {
            case Link.ContentType.Video:
                fullSentence = $"Watch {link.CreatorName}' JOI. {denialtext}";
                break;

            case Link.ContentType.Picture:

                if (Outcome == WheelExtension.Outcome.Edge)
                {
                    fullSentence         = $"Edge to {link.CreatorName}'s Picture and take a 30 second break. {denialtext}";
                    rerollIn             = "Don't forget to take a break! If you cum/ruin, use ``//came`` or ``//ruined``";
                    this.WheelLockedTime = new TimeSpan(0, 0, 30);
                }
                else
                {
                    fullSentence = $"Edge to {link.CreatorName}'s Picture and {denialtext}";
                }

                break;
            }

            if (this.Outcome != WheelExtension.Outcome.Edge)
            {
                rerollIn             = "You are not allowed to re-roll for now.";
                this.WheelLockedTime = new TimeSpan(8, 0, 0);
            }

            this.Text = $"{fullSentence}.{rerollIn}\n" + $"{link.Url}\n";

            var builder = new DiscordEmbedBuilder
            {
                Title       = "Click here.",
                Description = fullSentence,
                Footer      = new DiscordEmbedBuilder.EmbedFooter()
                {
                    Text = rerollIn
                },
                Url   = link.Url,
                Color = link.Type == Link.ContentType.Picture
                                                              ? new DiscordColor("#42f483")
                                                              : new DiscordColor("#acf441"),
                Author = new DiscordEmbedBuilder.EmbedAuthor()
                {
                    Name = link.CreatorName
                }
            };

            if (link.Type == Link.ContentType.Picture)
            {
                builder.ImageUrl = link.Url;
            }

            this.Embed = builder.Build();
        }
예제 #4
0
파일: Content.cs 프로젝트: Damitrix/Sabrina
        public override async Task BuildAsync()
        {
            Outcome = Outcome == UserSetting.Outcome.Task ? UserSetting.Outcome.Edge : Outcome;

            var denialText = GetDenialText();

            Link link = null;

            if (this.Outcome == UserSetting.Outcome.Edge)
            {
                Image = await((WaifuJOIBot)_services.GetService(typeof(WaifuJOIBot))).GetRandomPicture();

                HttpClient client = new HttpClient();
                using var response = await client.GetAsync(WaifuJOIBot.GetCreatorUrl(Image.CreatorId));

                var creator = await MessagePack.MessagePackSerializer.DeserializeAsync <WaifuJoi.Shared.Features.User.GetUserResponse>(
                    await response.Content.ReadAsStreamAsync());

                link = new Link
                {
                    CreatorName = creator.User.Name,
                    Url         = WaifuJOIBot.GetImageUrl(Image.Id),
                    Type        = Link.ContentType.Picture
                };
            }
            else
            {
                List <Link> links = await Link.LoadAll();

                var randomLinkNr = Helpers.RandomGenerator.RandomInt(0, links.Count);

                if (links.Count <= randomLinkNr)
                {
                    link = new Link()
                    {
                        CreatorName = Properties.Resources.ForgotLinkUpdate,
                        FileName    = Properties.Resources.ForgotLinkUpdate,
                        Type        = Link.ContentType.Picture,
                        Url         = Properties.Resources.ForgotLinkUpdate
                    };
                }
                else
                {
                    link = links[randomLinkNr];
                }
            }

            var fullSentence = string.Empty;
            var rerollIn     = string.Empty;

            switch (link.Type)
            {
            case Link.ContentType.Video:
                fullSentence = $"Watch {link.CreatorName}' JOI. {denialText}";
                break;

            case Link.ContentType.Picture:

                if (Outcome == UserSetting.Outcome.Edge)
                {
                    fullSentence         = $"Edge to {link.CreatorName}'s Picture and take a 30 second break. {denialText}";
                    rerollIn             = "Don't forget to take a break! If you cum/ruin, use ``//came`` or ``//ruined``";
                    this.WheelLockedTime = new TimeSpan(0, 0, 30);
                }
                else
                {
                    fullSentence = $"Edge to {link.CreatorName}'s Picture and {denialText}";
                }

                break;
            }

            if (this.Outcome != UserSetting.Outcome.Edge)
            {
                rerollIn             = "You are not allowed to re-roll for now.";
                this.WheelLockedTime = new TimeSpan(8, 0, 0);
            }

            this.Text = $"{fullSentence}.{rerollIn}\n" + $"{link.Url}\n";

            var builder = new DiscordEmbedBuilder
            {
                Title       = "Click here.",
                Description = fullSentence,
                Footer      = new DiscordEmbedBuilder.EmbedFooter()
                {
                    Text = rerollIn
                },
                Url   = link.Url,
                Color = link.Type == Link.ContentType.Picture
                                                                                                                          ? new DiscordColor("#42f483")
                                                                                                                          : new DiscordColor("#acf441"),
                Author = new DiscordEmbedBuilder.EmbedAuthor()
                {
                    Name = link.CreatorName
                }
            };

            if (link.Type == Link.ContentType.Picture)
            {
                builder.ImageUrl = link.Url;
            }

            this.Embed = builder.Build();
        }
예제 #5
0
파일: Feet.cs 프로젝트: Damitrix/Sabrina
 public Feet(SankakuBot sBot, WaifuJOIBot wjBot)
 {
     _sankakuBot  = sBot;
     _waifujoiBot = wjBot;
 }