Ejemplo n.º 1
0
        public async Task GetMensnc(IUser user = null)
        {
            try
            {
                var User   = user ?? Context.Message.Author;
                var joined = (User as SocketGuildUser);
                var data   = new EmbedBuilder();

                DateTime date1 = joined.JoinedAt.Value.Date;
                DateTime date2 = DateTime.UtcNow.Date;

                var    tim    = (date1);
                string mnth1  = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(joined.JoinedAt.Value.Month);
                String dayStr = DaySufix.DSufix(joined.JoinedAt.Value.Day);
                var    jdate  = $"{mnth1} {dayStr}/{joined.JoinedAt.Value.Year} at {joined.JoinedAt.Value.ToString("hh:mm tt")}";

                data.WithColor(new Color(0xB642f4));
                data.WithAuthor(x =>
                {
                    x.WithIconUrl(User.GetAvatarUrl());
                    x.Name = $"{User.Username}'s Time on the server";
                });


                int years = Int32.Parse(TimeSufix.yearSufixs(date1));
                int days  = Int32.Parse(TimeSufix.daySufixs(date1));

                if (years >= 1)
                {
                    data.WithDescription($"**Joined**: {jdate}\n**{years.ToString()} years, {days.ToString()} days ago**");
                }
                else
                {
                    data.WithDescription($"**Joined**: {jdate}\n**{days.ToString()} days ago**");
                }

                await ReplyAsync("", embed : data.Build());
            }
            catch (Exception)
            {
                var time   = user ?? Context.Message.Author;
                var joined = (time as SocketGuildUser);
                var data   = new EmbedBuilder();

                DateTime date1 = joined.JoinedAt.Value.Date;
                DateTime date2 = DateTime.UtcNow.Date;
                DateTime date3 = joined.JoinedAt.Value.Date;

                var    tim   = (date3);
                string mnth1 = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(joined.JoinedAt.Value.Month);

                var jdate = $"{mnth1} {joined.JoinedAt.Value.Day}/{joined.JoinedAt.Value.Year} at {joined.JoinedAt.Value.Hour}:{joined.JoinedAt.Value.Minute}";

                data.WithColor(new Color(0xB642f4));
                data.WithAuthor(x =>
                {
                    x.WithIconUrl(time.GetAvatarUrl());
                    x.Name = $"{time.Username}'s Time on the server";
                });

                data.AddField(x =>
                {
                    x.Name  = "Joined";
                    x.Value = jdate;
                });

                data.AddField(x =>
                {
                    x.Name  = " ";
                    x.Value = "Joined Today";
                });
                await ReplyAsync("", embed : data.Build());
            }
        }
Ejemplo n.º 2
0
        public async Task sayxync()
        {
            string mnth1 = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Context.Guild.CreatedAt.Month);

            String dayStr = DaySufix.DSufix(Context.Guild.CreatedAt.Day);
            var    jdate  = $"{mnth1} {dayStr}/{Context.Guild.CreatedAt.Year} at {Context.Guild.CreatedAt.ToString("hh:mm tt")}";
            var    data   = new EmbedBuilder();

            data.WithAuthor(x =>
            {
                x.IconUrl = Context.Guild.IconUrl;
                x.Name    = "Server Info";
            });

            data.WithDescription(Context.Guild.Name);

            DateTime date1 = Context.Guild.CreatedAt.DateTime;
            int      years = Int32.Parse(TimeSufix.yearSufixs(date1));
            int      days  = Int32.Parse(TimeSufix.daySufixs(date1));

            if (years >= 1)
            {
                data.WithDescription($"**Joined**: {jdate}\n**{years.ToString()} years, {days.ToString()} days ago**");
            }
            else
            {
                data.WithDescription($"**Joined**: {jdate}\n**{days.ToString()} days ago**");
            }

            data.WithColor(new Color(0xB642f4));
            data.AddField(x =>
            {
                x.WithIsInline(true);
                x.Name  = "Server Owner";
                x.Value = $"<@{Context.Guild.OwnerId.ToString()}>";
            });

            data.AddField(x =>
            {
                var users = Context.Guild.GetUsersAsync();
                x.WithIsInline(true);
                x.Name  = "Members";
                x.Value = users.Result.Count.ToString();
            });
            data.AddField(x =>
            {
                var users = Context.Guild.GetUsersAsync();
                x.WithIsInline(true);
                x.Name  = "ID";
                x.Value = Context.Guild.Id.ToString();
            });

            data.AddField(x =>
            {
                x.WithIsInline(true);
                x.Name  = "Region";
                x.Value = Context.Guild.VoiceRegionId;
            });


            data.AddField(x =>
            {
                x.WithIsInline(true);
                x.Name  = "Security";
                x.Value = Context.Guild.MfaLevel.ToString();
            });

            data.AddField(x =>
            {
                x.WithIsInline(true);
                x.Name  = "Verification Level";
                x.Value = Context.Guild.VerificationLevel.ToString();
            });
            var rolle = Context.Guild.Roles.Count;

            data.AddField(x =>
            {
                x.WithIsInline(true);
                x.Name  = "Roles";
                x.Value = rolle.ToString();
            });

            data.WithImageUrl($"https://images.discordapp.net/icons/{Context.Guild.Id}/{Context.Guild.IconId}.webp?size=1024");

            await ReplyAsync("", embed : data.Build());
        }