Beispiel #1
0
        private async Task UsersAsync()
        {
            await Context.Message.DeleteAsync();

            var bot    = LCommandHandler.GetBot();
            int guilds = bot.Guilds.Count;
            int users  = (await Context.Guild.GetUsersAsync()).Count;
            int total  = 0;

            foreach (var guild in bot.Guilds)
            {
                total += guild.Users.Count;
            }

            EmbedBuilder embed = new EmbedBuilder()
            {
                Title       = "Lori's Angels Statistics",
                Color       = Color.DarkPurple,
                Description = $"Out of the {guilds} guilds I am watching {total} total users, {users} of which are from this guild!",
                Footer      = new EmbedFooterBuilder()
                {
                    Text = $"{EmojiUtil.GetRandomEmoji()}  Requested by {Context.User.Username}#{Context.User.Id}"
                }
            };

            await Context.Channel.SendMessageAsync(null, false, embed.Build());
        }
Beispiel #2
0
        private async Task DailyAsync()
        {
            await Context.Message.DeleteAsync();

            LoriUser profile = ProfileDatabase.GetUser(Context.User.Id);

            if (profile == null)
            {
                await MessageUtil.SendErrorAsync((Context.Channel as ITextChannel), "Transfer Error", $"We could not find your bank account.");

                return;
            }

            var  tgg      = LCommandHandler.GetTopGGClient();
            bool hasVoted = await tgg.HasVoted(Context.User.Id);

            if (hasVoted)
            {
                // check if already claimed
                if (ProfileDatabase.HasClaimedDaily(Context.User.Id))
                {
                    DateTime claimAt     = profile.Claimed.AddHours(12.0);
                    var      timeToClaim = claimAt - DateTime.Now;
                    await MessageUtil.SendErrorAsync(Context.Channel as ITextChannel, "Already Claimed", $"You can claim your daily in {timeToClaim.Hours} hours and {timeToClaim.Minutes} minutes.", false);
                }
                else
                {
                    ProfileDatabase.ClaimDaily(Context.User.Id);

                    float        newAmt = profile.GetCurrency();
                    EmbedBuilder embed  = new EmbedBuilder()
                    {
                        Color       = Color.DarkPurple,
                        Title       = "Daily Bonus Claimed",
                        Description = $"New bank balance: ${newAmt}"
                    };
                    await Context.Channel.SendMessageAsync(null, false, embed.Build());
                }
            }
            else
            {
                EmbedBuilder embed = new EmbedBuilder()
                {
                    Color  = Color.DarkPurple,
                    Author = new EmbedAuthorBuilder()
                    {
                        Name = "Click here to vote!", Url = "https://top.gg/bot/729696788097007717/vote"
                    },
                    Description = $"Vote on TopGG and then claim your daily!",
                    Footer      = new EmbedFooterBuilder()
                    {
                        Text = "If you can't click above, head to this url https://top.gg/bot/729696788097007717/vote"
                    }
                };
                await Context.Channel.SendMessageAsync(null, false, embed.Build());
            }
        }
Beispiel #3
0
        private async Task RequestDataAsync()
        {
            var dm = await Context.User.GetOrCreateDMChannelAsync();

            await dm.SendMessageAsync("**You have requested your data to be deleted.**\nYour request will be processed and you will receive a message confirming the deletion of your data. You must be in a server with this bot in order to receive the confirmation.\n\nPlease note that your data will be regenerated as needed if you remain in a server with the bot, as it is required for the bot to operate.");

            var logChannel = LCommandHandler.GetBot().GetGuild(730573219374825523).GetTextChannel(808283333623939093);
            await logChannel.SendMessageAsync($"User {Context.User.Id} has requested their data to be deleted.");
        }
Beispiel #4
0
        private async Task MessageOwnerAsync([Remainder] string message = null)
        {
            if (message == null)
            {
                BotConfig conf  = BotConfig.Load();
                var       gconf = conf.GetConfig(Context.Guild.Id);
                await MessageUtil.SendErrorAsync((Context.Channel as ITextChannel), "Incorrect Command Usage", $"Correct Usage: `{gconf.Prefix}messageowner <message>`", false);

                return;
            }

            var logChannel = LCommandHandler.GetBot().GetGuild(730573219374825523).GetTextChannel(808283416533270549);
            await logChannel.SendMessageAsync($"-- -- -- -- --\n**From:** {Context.User.Username}#{Context.User.Discriminator} ({Context.User.Id})\n**Time:** {DateTime.Now}\n\n{message}\n-- -- -- -- --");

            await Context.Channel.SendMessageAsync("Message sent.");
        }
Beispiel #5
0
        private async Task ConfirmDataAsync(ulong id = 0L)
        {
            if (Context.User.Id != 211938243535568896)
            {
                return;
            }
            if (id == 0L)
            {
                await MessageUtil.SendErrorAsync(Context.Channel as ITextChannel, "Error", "Need an ID");
            }

            var user = LCommandHandler.GetBot().GetUser(id);
            var dm   = await user.GetOrCreateDMChannelAsync();

            await dm.SendMessageAsync("**Your data has been deleted successfully.**\n\nPlease note that your data will be regenerated as needed if you remain in a server with the bot, as it is required for the bot to operate.");

            await Context.Channel.SendMessageAsync("Done.");
        }
Beispiel #6
0
        private async Task ViewProfileAsync(ICommandContext Context, IUser User)
        {
            if (User.IsBot)
            {
                await MessageUtil.SendErrorAsync((Context.Channel as ITextChannel), "Profile Not Found", $"You can not use this command on bots!", false);

                return;
            }

            while (!ProfileDatabase.Ready())
            {
                await Task.Delay(50);
            }

            LoriUser profile = ProfileDatabase.GetUser(User.Id);

            if (profile == null)
            {
                await MessageUtil.SendErrorAsync((Context.Channel as ITextChannel), "Profile Not Found", $"That users profile could not be found?", false);

                return;
            }

            string avatar = User.GetAvatarUrl(size: 2048);
            string status = "**" + User.Status.ToString() + " for ";

            Color color;

            switch (User.Status)
            {
            case UserStatus.Offline:
                color = Color.LightGrey;
                break;

            case UserStatus.Online:
                color = Color.Green;
                break;

            case UserStatus.Idle:
                color = Color.Orange;
                break;

            case UserStatus.AFK:
                color = Color.Orange;
                break;

            case UserStatus.DoNotDisturb:
                color = Color.Red;
                break;

            case UserStatus.Invisible:
                color = Color.LightGrey;
                break;

            default:
                color = Color.LightGrey;
                break;
            }

            DateTime now     = DateTime.Now;
            int      seconds = (int)((now - profile.LastSeen).TotalSeconds);
            int      minutes = (int)((now - profile.LastSeen).TotalMinutes);
            int      hours   = (int)((now - profile.LastSeen).TotalHours);
            int      days    = (int)((now - profile.LastSeen).TotalDays);

            if (days > 0)
            {
                status += $"{days} Days and {hours - (days * 24)} Hours**";
            }
            else if (hours > 0)
            {
                status += $"{hours} Hours and {minutes - (hours * 60)} Minutes**";
            }
            else if (minutes > 0)
            {
                status += $"{minutes} Minutes and {seconds - (minutes * 60)} Seconds**";
            }
            else
            {
                status += $"{seconds} Seconds**";
            }

            if (User.Status == UserStatus.Offline || User.Status == UserStatus.Invisible)
            {
                status += $"\n _{profile.Activity}_";
            }
            else
            {
                status += $"\n {profile.Activity}";
            }

            if (profile.Motto.Length > 0)
            {
                status += $"\n**Motto:** {profile.Motto}";
            }

            EmbedBuilder embed = new EmbedBuilder()
            {
                Author = new EmbedAuthorBuilder()
                {
                    IconUrl = avatar, Name = $"{User.Username}#{User.Discriminator}"
                },
                Description = status,
                Color       = color,
                Footer      = new EmbedFooterBuilder()
                {
                    Text = $"{EmojiUtil.GetRandomEmoji()}  This is a temporary look for profiles..."
                },
            };

            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Account Created On: ", Value = profile.CreatedOn.ToShortDateString(), IsInline = true
            });
            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Profile Created On: ", Value = profile.JoinedOn.ToShortDateString(), IsInline = true
            });
            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Last Updated On: ", Value = profile.LastUpdated.ToShortDateString(), IsInline = true
            });
            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Unique Identifier: ", Value = profile.Id, IsInline = true
            });
            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Username: "******"#" + User.Discriminator, IsInline = true
            });
            embed.AddField(new EmbedFieldBuilder()
            {
                Name = "Lori's Angel Guilds: ", Value = LCommandHandler.GetUserGuildCount(User.Id), IsInline = true
            });

            ProfileRenderer renderer = new ProfileRenderer(User.Id, profile);

            renderer.Render();
            await Context.Channel.SendFileAsync(renderer.GetPath());

            renderer.Dispose();

            await Context.Channel.SendMessageAsync(null, false, embed.Build());
        }