Esempio n. 1
0
        public async Task AutoLewdIMG(string arg)
        {
            var guildAcc = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var botAcc   = BotAccounts.GetAccount();
            var result   = ConvertBool.ConvertStringToBoolean(arg);

            if (!result.Item1)
            {
                await SendMessage(Context, null, $"Please say `n!autolewd <on/off>`");
            }

            else if (result.Item2)
            {
                await SendMessage(Context, null, $"Started the AutoLewd loop :3");

                guildAcc.AutoLewdStatus = Enabled;
                botAcc.AutoLewdGuilds.Add(guildAcc.Id);
                GlobalGuildAccounts.SaveAccounts(Context.Guild.Id);
                BotAccounts.SaveAccounts();
            }

            else if (!result.Item2)
            {
                guildAcc.AutoLewdStatus = Disabled;
                botAcc.AutoLewdGuilds.Remove(guildAcc.Id);
                GlobalGuildAccounts.SaveAccounts(Context.Guild.Id);
                BotAccounts.SaveAccounts();
                await SendMessage(Context, null, $"Stopped the AutoLewd loop :/");
            }
        }
Esempio n. 2
0
        public async Task UnblockChannel()
        {
            var guildUser = Context.User as SocketGuildUser;

            if (!guildUser.GuildPermissions.ManageChannels)
            {
                string description =
                    $"{Global.ENo} **|** You Need the **Manage Channels** Permission to do that {Context.User.Username}";
                var errorEmbed = EmbedHandler.CreateEmbed(Context, "Error", description,
                                                          EmbedHandler.EmbedMessageType.Exception);
                await ReplyAndDeleteAsync("", embed : errorEmbed);

                return;
            }

            var config = BotAccounts.GetAccount();

            config.BlockedChannels.Remove(Context.Channel.Id);
            BotAccounts.SaveAccounts();

            var embed = MiscHelpers
                        .CreateEmbed(Context, "Channel Unblocked", $":unlock: Unblocked {Context.Channel.Name}.")
                        .WithColor(Constants.DefaultColor);

            await SendMessage(Context, embed.Build());
        }
Esempio n. 3
0
        private async void OnTimerTicked(object sender, ElapsedEventArgs e)
        {
            var config = BotAccounts.GetAccount();

            foreach (var guild in config.AutoLewdGuilds)
            {
                Embed embed = null;
                var   rand  = Global.Rng.Next(1, 3);
                if (rand == 1)
                {
                    var nekoLink = NekosLifeHelper.GetNekoLink("lewd");

                    embed = ImageEmbed.GetImageEmbed(nekoLink, Source.NekosLife);
                }

                else if (rand == 2)
                {
                    string[] tags   = { "" };
                    var      webReq = new WebRequest();
                    var      result = await webReq.GetTypesAsync("neko", tags, FileType.Any, NsfwSearch.Only, false);

                    var url = result.Url;
                    embed = ImageEmbed.GetImageEmbed(url, Source.WeebDotSh);
                }

                var guildAcc = GlobalGuildAccounts.GetGuildAccount(guild);
                await Program._client.GetGuild(guildAcc.Id).GetTextChannel(guildAcc.AutoLewdChannel)
                .SendMessageAsync("", embed: embed);
            }

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Successfully sent Autolewd");
        }
Esempio n. 4
0
        public async Task Update()
        {
            var version = Config.bot.version;
            var config  = BotAccounts.GetAccount();
            var embed   = EmbedHandler.CreateEmbed(Context, "Update Notes",
                                                   $"**<<Last Updated on {config.LastUpdate.ToShortDateString()}>>**\n`Version {version}`\n" +
                                                   config.ChangeLog,
                                                   EmbedHandler.EmbedMessageType.Success);

            await SendMessage(Context, embed);
        }
Esempio n. 5
0
File: Owner.cs Progetto: Phytal/Nayu
        public async Task SetChangeLog([Remainder] string changeLog)
        {
            var config = BotAccounts.GetAccount();

            config.ChangeLog  = changeLog;
            config.LastUpdate = DateTime.Today;
            var embed = EmbedHandler.CreateEmbed(Context, "Update Change Log",
                                                 $"Set the bot's changeLog to ```{changeLog}```", EmbedHandler.EmbedMessageType.Success);

            await SendMessage(Context, embed);
        }
Esempio n. 6
0
        public async Task Info()
        {
            var config  = BotAccounts.GetAccount();
            var version = Config.bot.version;
            var embed   = new EmbedBuilder();

            embed.WithColor(Global.NayuColor);
            embed.AddField("Creator", "Phytal#8213", true);
            embed.AddField("Last Updated", config.LastUpdate.ToShortDateString(), true);
            embed.AddField("Bot version", $"Beta {version}", true);
            embed.AddField("Vote Link", "https://discordbots.org/bot/417160957010116608/vote");
            embed.AddField("Invite Link",
                           "https://discordapp.com/api/oauth2/authorize?client_id=417160957010116608&permissions=8&scope=bot");
            embed.AddField("Patreon Link", "https://www.patreon.com/phytal");
            embed.WithImageUrl(Global.Client.CurrentUser.GetAvatarUrl());

            await SendMessage(Context, embed.Build());
        }
Esempio n. 7
0
        public async Task HandleCommandAsync(SocketMessage s)
        {
            _ = SlowMode.Slowmode(s);

            if (!(s is SocketUserMessage msg))
            {
                return;
            }
            if (msg.Channel is SocketDMChannel)
            {
                return;
            }

            var context = new ShardedCommandContext(_client, msg);

            if (context.User.IsBot)
            {
                return;
            }

            var botConfig = BotAccounts.GetAccount();
            var guildUser = context.User as SocketGuildUser;

            if (botConfig.BlockedChannels.ContainsKey(msg.Channel.Id) &&
                !guildUser.GuildPermissions.ManageChannels)
            {
                return;
            }

            var config = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id);
            var prefix = config.CommandPrefix ?? Config.bot.cmdPrefix;

            var argPos = 0;

            if (msg.HasStringPrefix(prefix, ref argPos) &&
                (context.Guild == null || context.Guild.Id != 264445053596991498 ||
                 context.Guild.Id != 396440418507816960) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos) &&
                (context.Guild == null || context.Guild.Id != 264445053596991498 ||
                 context.Guild.Id != 396440418507816960))
            {
                foreach (var command in config.CustomCommands)
                {
                    if (msg.HasStringPrefix($"{config.CommandPrefix}{command.Key}", ref argPos))
                    {
                        await SendMessage(Context, null, command.Value);
                    }
                }

                var cmdSearchResult = _commands.Search(context, argPos);
                if (cmdSearchResult.Commands.Count == 0)
                {
                    await SendMessage(Context, null, $"{context.User.Mention}, that is not a valid command");
                }

                var executionTask = _commands.ExecuteAsync(context, argPos, _services);

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                executionTask.ContinueWith(task =>
                {
                    if (task.Result.IsSuccess || task.Result.Error == CommandError.UnknownCommand)
                    {
                        return;
                    }
                    const string errTemplate = "{0}, Error: {1}";
                    var errMessage           = string.Format(errTemplate, context.User.Mention, task.Result.ErrorReason);
                    var embed = EmbedHandler.CreateEmbed(context, "Error!", errMessage,
                                                         EmbedHandler.EmbedMessageType.Error);
                    SendMessage(context, embed);
                });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }