Пример #1
0
        private async Task OnJoinedGuild(SocketGuild arg)
        {
            await arg.DefaultChannel.TriggerTypingAsync();

            var builder = new EmbedBuilder()
                          .WithThumbnailUrl(arg.CurrentUser.GetAvatarUrl())
                          .WithTitle("Thanks for inviting me!")
                          .WithDescription("I'm still in training, please take care of me...\nType !help for a list of commands.")
                          .WithColor(new Color(33, 176, 252))
                          .WithCurrentTimestamp();
            var embed = builder.Build();
            await arg.DefaultChannel.SendMessageAsync(null, false, embed);

            //calls this method whenever bibs joins a new server so bibs doesn't do a die
            await _servers.ClearFilterAsync(arg.Id);

            await _servers.ClearRaidAsync(arg.Id);

            await _servers.ClearNoWeebAsync(arg.Id);

            await _servers.ClearHasLimitAsync(arg.Id);

            await _servers.ClearHasMarkovAsync(arg.Id);

            await _client.SetGameAsync($"over {_client.Guilds.Count} servers!", null, ActivityType.Watching);
        }
Пример #2
0
        public async Task CatGirl()
        {
            var client = new HttpClient();
            var result = await client.GetStringAsync("https://nekos.moe/api/v1/random/image?count=1&nsfw=false");

            if (result == null)
            {
                await Context.Channel.SendErrorAsync("Neko API", "Something went wrong with the Neko API!");

                return;
            }
            var neko = JsonConvert.DeserializeObject <dynamic>(result);

            if ((Context.Channel as IDMChannel) != null)
            {
                var builder = new EmbedBuilder()
                              .WithColor(new Color(33, 176, 252))
                              .WithTitle("Neko")
                              .WithUrl($"https://nekos.moe/image/{neko.images[0].id.ToString()}")
                              .WithImageUrl($"https://nekos.moe/image/{neko.images[0].id.ToString()}");
                await Context.Channel.TriggerTypingAsync();
                await ReplyAsync(embed : builder.Build());

                return;
            }
            else if ((Context.Channel as ITextChannel) != null)
            {
                var guild = (Context.Channel as SocketTextChannel)?.Guild;
                try
                {
                    var guildHasWeebBlackist = _servers.GetNoWeebAsync(guild.Id).Result;
                    if (guildHasWeebBlackist == true)
                    {
                        var newTask = new Task(async() => await HandleWeebBlacklist());
                        newTask.Start();
                        return;
                    }
                }
                catch (Exception)
                {
                    await _servers.ClearFilterAsync(guild.Id);

                    await Context.Channel.SendErrorAsync("Error", "Something went wrong, please try again, if the bot is unresponsive, contact Ribs#8205 on discord.");
                }
                var builder = new EmbedBuilder()
                              .WithColor(new Color(33, 176, 252))
                              .WithTitle("Neko")
                              .WithUrl($"https://nekos.moe/image/{neko.images[0].id.ToString()}")
                              .WithImageUrl($"https://nekos.moe/image/{neko.images[0].id.ToString()}");
                await Context.Channel.TriggerTypingAsync();
                await ReplyAsync(embed : builder.Build());

                return;
            }
            else
            {
                await Context.Channel.TriggerTypingAsync();

                await Context.Channel.SendErrorAsync("Weeb Module", "This command is inappropriate to use here, use it in nsfw or in DMs!");

                return;
            }
        }